package com.crm.system.controller;

import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.crm.common.util.CommonUtils;
import com.crm.common.util.DateUtil;
import com.crm.common.util.FileUtil;
import com.crm.common.util.PathUtil;
import com.crm.model.entity.activityManager.CustomerProductActivity;
import com.crm.model.entity.activityManager.CustomerProductGiftActivity;
import com.crm.model.entity.cluePoolManager.CluePoolPrivate;
import com.crm.model.entity.cluePoolManager.CluePoolPublic;
import com.crm.model.entity.common.Dictionary;
import com.crm.model.entity.csd.customerManager.CustomerInfo;
import com.crm.model.entity.customerManager.CustomerOrderBackMoney;
import com.crm.model.entity.customerManager.CustomerOrderBackMoneyExamine;
import com.crm.model.entity.sys.*;
import com.crm.model.entity.sys.permissionManagement.SysCompany;
import com.crm.model.entity.workOrderManager.WorkOrder;
import com.crm.model.qo.contactManager.AddContactInformationQO;
import com.crm.model.qo.opportunityManager.AddOpportunityQO;
import com.crm.model.vo.announcement.NewsVO;
import com.crm.model.vo.cluePoolManager.ClueEditVO;
import com.crm.model.vo.cluePoolManager.ClueFollowVO;
import com.crm.model.vo.contactManager.ContactVO;
import com.crm.model.vo.contractReviewManager.ContractReviewVO;
import com.crm.model.vo.csd.customerManager.CustomerDetailVO;
import com.crm.model.vo.csd.customerManager.CustomerMemberCardDetailVO;
import com.crm.model.vo.customerContractManager.CustomerContractDetailVO;
import com.crm.model.vo.customerContractManager.CustomerContractEditVO;
import com.crm.model.vo.customerManager.CustomerVO;
import com.crm.model.vo.customerManager.VipCustomerAnalyseVO;
import com.crm.model.vo.opportunityManager.OpportunityVO;
import com.crm.model.vo.orderManager.ApplyInvoiceOrderInfoVO;
import com.crm.model.vo.orderManager.CustomerProductOrderVO;
import com.crm.model.vo.orderManager.OrderDetailVO;
import com.crm.model.vo.returnMoney.FinanceProductOderInfoVO;
import com.crm.model.vo.trainingManager.TrainingContractDetailVO;
import com.crm.model.vo.trainingManager.TrainingDetailVO;
import com.crm.model.vo.trainingManager.TrainingVO;
import com.crm.model.vo.user.UserInfoVO;
import com.crm.model.vo.userForumManager.UserForumInfoVO;
import com.crm.service.activityManager.CustomerProductActivityDbService;
import com.crm.system.service.FileUploadService;
import com.crm.system.service.activityManager.CustomerProductGiftActivityService;
import com.crm.system.service.cluePoolManager.*;
import com.crm.system.service.contactManager.ContactService;
import com.crm.system.service.contractManager.CustomerContractService;
import com.crm.system.service.contractReviewManager.ContractReviewService;
import com.crm.system.service.customerManager.CustomerPoolService;
import com.crm.system.service.customerManager.CustomerService;
import com.crm.system.service.index.AnnouncementService;
import com.crm.system.service.index.NewsService;
import com.crm.system.service.opportunityManager.OpportunityService;
import com.crm.system.service.orderManager.CustomerProductOrderService;
import com.crm.system.service.permissionManagement.SysCompanyService;
import com.crm.system.service.sendRoyaltyManager.SendRoyaltyService;
import com.crm.system.service.trainingManager.TrainingContractService;
import com.crm.system.service.trainingManager.TrainingService;
import com.crm.system.service.user.UserAccountService;
import com.crm.system.service.user.UserInfoService;
import com.crm.system.service.userForumManager.UserForumService;
import com.crm.system.service.workOrderManager.WorkOrderService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * @author WangFei
 * @date 2020/12/18 11:23
 */
@Slf4j
@Controller
@RequestMapping("/front")
public class FrontendController {

    @Value("${esurl}")
    public String ESurl;

    /**
     * @author chengyun
     * @date 2021年11月17日 上午 09:27:13
     * info dc_spider项目的服务器地址
     */
    @Value("${spider-url}")
    public String spiderUrl;

    @Autowired
    FileUploadService fileUploadService;
    @Autowired
    NewsService newsService;
    @Autowired
    UserAccountService userAccountService;
    @Autowired
    AnnouncementService announcementService;
    @Autowired
    ClueService clueService;
    @Autowired
    CluePoolPublicService cluePoolPublicService;
    @Autowired
    CluePoolPrivateService cluePoolPrivateService;
    @Autowired
    CustomerService customerService;
    @Autowired
    CustomerPoolService customerPoolService;
    @Autowired
    OpportunityService opportunityService;
    @Autowired
    CluePoolStatisticsService cluePoolStatisticsService;
    @Autowired
    CustomerProductActivityDbService customerProductActivityService;
    @Autowired
    CustomerProductGiftActivityService customerProductGiftActivityService;

    @Autowired
    ContactService contactService;

    @Autowired
    ContractReviewService contractReviewService;

    @Autowired
    UserInfoService userInfoService;

    @Autowired
    CustomerProductOrderService customerProductOrderService;

    @Autowired
    CustomerContractService customerContractService;

    //跟进service
    @Autowired
    ClueFollowService clueFollowService;

    @Autowired
    SendRoyaltyService sendRoyaltyService;

    @Autowired
    UserForumService userForumService;

    @Autowired
    WorkOrderService workOrderService;

    @Autowired
    TrainingService trainingService;

    @Autowired
    TrainingContractService trainingContractService;

    @Autowired
    SysCompanyService sysCompanyService;

    @Autowired
    com.crm.system.service.csd.customerManager.CustomerService csdCustomerService;


    /**
     * 轮播图详情跳转接口
     *
     * @param request
     * @return
     */
    @RequestMapping("/carousel/carouselDetail")
    public String editCarousel(HttpServletRequest request,
                               ModelMap model,
                               @RequestParam(value = "id") Integer id) {
        News news = newsService.getNewsInfoByNewOrder(id);
        if (news != null) {
            UserAccount userAccount = userAccountService.selectUserAccountByAccountId(news.getCreatePeopleId());
            FileUpload fileUpload = fileUploadService.selectFileUploadById(news.getUploadId());
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String publishTm = formatter.format(news.getCreateTm());
            model.addAttribute("newsTitle", news.getNewsTitle());
            model.addAttribute("newsContent", news.getNewsContent());
            model.addAttribute("createTm", publishTm);
            model.addAttribute("createPeopleName", userAccount.getUserName());
            model.addAttribute("accessUrl", fileUpload.getAccessUrl());
        }
        String url = "crmSystem/carousel/carouselDetail";
        return url;
    }

    /**
     * 轮播图编辑跳转接口
     *
     * @param request
     * @return
     */
    @RequestMapping("/carousel/editCarousel")
    public String editCarousel(HttpServletRequest request, ModelMap model) {
        List<NewsVO> newsVOS = newsService.getImgList();
        model.addAttribute("news", newsVOS);
        String url = "crmSystem/carousel/editCarousel";
        return url;
    }

    /**
     * 管理模块-线索池创建
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/cluePoolManager/addCluePool")
    public String addCluePool(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/cluePoolManager/addCluePool";
        return url;
    }

    /**
     * 线索池表单
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/cluePoolManager/cluePoolForm")
    public String cluePoolForm(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/cluePoolManager/cluePoolForm";
        return url;
    }

    /**
     * 线索池详情
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/cluePoolManager/cluePoolDetail")
    public String cluePoolDetail(HttpServletRequest request, ModelMap model,
                                 @RequestParam String poolId,//线索池ID
                                 @RequestParam String poolCategory,//线索池类别
                                 @RequestParam Integer poolState,//启用&停用状态
                                 @RequestParam Integer defaultMark,//是否是默认池子(0-不是默认；1-默认池子)
                                 @RequestParam Integer allocation,//分配方式：0-混合模式(包括主动领取和主动分配);1-被动分配
                                 @RequestParam String companyId, //公司id
                                 @RequestParam Boolean poolPermissionFlag //是否显示权限与详情tab页
    ) {
        model.addAttribute("poolId", poolId);
        model.addAttribute("poolCategory", poolCategory);
        model.addAttribute("poolState", poolState);
        model.addAttribute("defaultMark", defaultMark);
        model.addAttribute("allocation", allocation);
        model.addAttribute("companyId", companyId);
        model.addAttribute("poolPermissionFlag", poolPermissionFlag);
        CluePoolPublic cluePoolPublic = cluePoolPublicService.selectCluePoolPublicById(poolId);
        //查询线索池详情
        if ("1".equals(poolCategory)) {
            model.addAttribute("poolDetail", cluePoolPublic.getPoolDetail());
        }
        String url = "crmSystem/cluePoolManager/cluePoolDetail";
        return url;
    }

    /**
     * 添加公告页面跳转接口
     *
     * @param request
     * @return
     */
    @GetMapping("/announcement/addAnnouncement")
    public String addAnnouncement(HttpServletRequest request) {
        String url = "crmSystem/announcement/addAnnouncement";
        return url;
    }

    /**
     * 查询公告详情
     *
     * @return
     */
    @GetMapping("/announcement/getAnnouncementDetail")
    public String getAnnouncementDetail(@RequestParam String id, ModelMap model, @RequestParam(required = false) String type) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        String url = "crmSystem/announcement/announcementDetail";
        Notify notify = announcementService.selectNotifyById(id);
        ArrayList<FileUpload> fileUploads = new ArrayList<FileUpload>();
        if (!StringUtils.isBlank(notify.getUploadId())) {
            ArrayList<String> list = new ArrayList(Arrays.asList(notify.getUploadId().split(",")));
            list.stream().forEach(item -> {
                FileUpload fileUpload = fileUploadService.selectFileUploadById(item);
                //文件存在才添加
                if (fileUpload != null) {
                    fileUploads.add(fileUpload);
                }
            });
        }
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String publishTm = formatter.format(notify.getCreateTm());
        model.addAttribute("publisher", notify.getCreatePeople());
        model.addAttribute("notifyId", id);
        model.addAttribute("publishTm", publishTm);
        model.addAttribute("title", notify.getTitle());
        model.addAttribute("notifyContent", notify.getNotifyContent());
        model.addAttribute("isTop", notify.getIsTop());
        model.addAttribute("files", fileUploads);
        //为了编辑附件使用
        model.addAttribute("filePath", notify.getUploadId());
        model.addAttribute("type", type);//1用户模块-公告查看
        return url;
    }


    /**
     * 添加新闻页面跳转接口
     *
     * @param request
     * @return
     */
    @GetMapping("/newsController/addNotify")
    public String addNotify(HttpServletRequest request) {
        String url = "crmSystem/notify/addNotify";
        return url;
    }


    /**
     * 查询新闻详情
     *
     * @return
     */
    @GetMapping("/newsController/getNotifyDetail")
    public String getNotifyDetail(@RequestParam String id, ModelMap model) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        String url = "crmSystem/notify/notifyDetail";
        Notify notify = newsService.selectNotifyById(id);
        ArrayList<FileUpload> fileUploads = new ArrayList<FileUpload>();
        if (!StringUtils.isBlank(notify.getUploadId())) {
            ArrayList<String> list = new ArrayList(Arrays.asList(notify.getUploadId().split(",")));
            list.stream().forEach(item -> {
                FileUpload fileUpload = fileUploadService.selectFileUploadById(item);
                //文件存在才添加
                if (fileUpload != null) {
                    fileUploads.add(fileUpload);
                }
            });
        }
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String publishTm = formatter.format(notify.getCreateTm());
        model.addAttribute("publisher", notify.getCreatePeople());
        model.addAttribute("notifyId", id);
        model.addAttribute("publishTm", publishTm);
        model.addAttribute("title", notify.getTitle());
        model.addAttribute("notifyContent", notify.getNotifyContent());
        model.addAttribute("files", fileUploads);
        //为了编辑附件使用
        model.addAttribute("filePath", notify.getUploadId());
        return url;
    }

    /**
     * 线索池创建
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/user/cluePoolManager/addCluePool")
    public String save(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/cluePoolManager/user/saveCluePoolPrivate";
        return url;
    }


    /**
     * info 用户模块-我的线索池
     *
     * @param request
     * @param model
     * @return
     */

    @RequestMapping("user/cluePoolManager/myCluePool")
    public String myCluePool(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/cluePoolManager/user/list";
        return url;
    }

    /**
     * 用户模块-线索池公海
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("user/cluePoolManager/cluePoolForm")
    public String cluePoolOpenSea(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/cluePoolManager/user/cluePoolOpenSea";
        return url;
    }

    /**
     * 管理模块-新增线索
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/cluePoolManager/addClue")
    public String addClue(HttpServletRequest request,
                          @RequestParam String poolId,
                          @RequestParam String poolCategory,//线索池类别
                          @RequestParam Integer poolState,//启用&停用状态
                          @RequestParam Integer defaultMark,//是否是默认池子(0-不是默认；1-默认池子)
                          @RequestParam Integer allocation,//分配方式：0-混合模式(包括主动领取和主动分配);1-被动分配
                          @RequestParam String companyId, //公司id
                          @RequestParam Boolean poolPermissionFlag, //是否显示权限与详情tab页
                          ModelMap model) {
        model.addAttribute("poolId", poolId);
        model.addAttribute("poolCategory", poolCategory);
        model.addAttribute("poolState", poolState);
        model.addAttribute("defaultMark",defaultMark);
        model.addAttribute("allocation",allocation);
        model.addAttribute("companyId",companyId);
        model.addAttribute("poolPermissionFlag",poolPermissionFlag);
        String url = "crmSystem/cluePoolManager/addClue";
        return url;
    }

    /**
     * 线索清单--线索详情跳转
     *
     * @return
     */
    @GetMapping("/cluePoolManager/clueDetail")
    public String clueDetail(@RequestParam(value = "clueId") String clueId, @RequestParam(value = "poolId") String poolId,
                             @RequestParam(value = "poolCategory") String poolCategory,//线索池类别
                             @RequestParam(value = "poolState") Integer poolState,//启用&停用状态
                             @RequestParam(value = "defaultMark") Integer defaultMark,//是否是默认池子(0-不是默认；1-默认池子)
                             @RequestParam(value = "allocation") Integer allocation,//分配方式：0-混合模式(包括主动领取和主动分配);1-被动分配)
                             ModelMap model) {
        ClueEditVO clueEditVO = clueService.selectClueByClueId(clueId);
        model.addAttribute("clue", clueEditVO);//线索信息
        model.addAttribute("clueId", clueId);//线索主键
        model.addAttribute("poolId", poolId);//线索池ID
        model.addAttribute("poolCategory", poolCategory);//线索类别
        model.addAttribute("poolState", poolState);//线索状态
        model.addAttribute("defaultMark", defaultMark);//是否是默认池
        model.addAttribute("allocation", allocation);//线索分配方式
        return "crmSystem/cluePoolManager/clueDetail";
    }

    /**
     * 公海查看
     *
     * @param request 全国 公司 我参与的
     * @return
     */
    @RequestMapping("/user/cluePoolOpenSeaDetail")
    public String cluePoolOpenSeaDetail(HttpServletRequest request, ModelMap model, @RequestParam(value = "poolId") String poolId) {//线索池ID
        model.addAttribute("poolId", poolId);
        String url = "crmSystem/cluePoolManager/user/cluePoolOpenSeaDetail";
        //存入线索池使用次数
        cluePoolStatisticsService.addCluePoolUsageCount(poolId);
        return url;
    }

    /**
     * 我的线索池查看
     *
     * @param request 个人
     * @return
     */
    @RequestMapping("/user/myClueDetail")
    public String myClueDetail(HttpServletRequest request, ModelMap model, @RequestParam(value = "poolId") String poolId
/*                               @RequestParam(value = "defaultMark") Integer defaultMark,
                               @RequestParam(value = "capacity", required = false) String capacity*/) {
        long num = clueService.selectCluePoolPrivateCount(poolId);
        CluePoolPrivate cluePoolPrivate = cluePoolPrivateService.selectPoolPrivateById(poolId);
        Integer capacity = cluePoolPrivate.getCapacity();
        model.addAttribute("poolId", poolId);
        //是否是默认池子：0-不是默认；1-默认池子
        model.addAttribute("defaultMark", cluePoolPrivate.getDefaultMark());
        model.addAttribute("usage", num);
        model.addAttribute("capacity", capacity);
        String url = "crmSystem/cluePoolManager/user/myClueDetail";
        return url;
    }

    /**
     * 用户端新增线索
     *
     * @param request
     * @param model
     * @param poolId
     * @return
     */
    @RequestMapping("/user/addClue")
    public String addClue(HttpServletRequest request, ModelMap model, @RequestParam(value = "poolId") String poolId//线索池ID
            , @RequestParam(value = "defaultMark") String defaultMark
            , @RequestParam(value = "capacity") String capacity) {
        model.addAttribute("poolId", poolId);
        model.addAttribute("defaultMark", defaultMark);
        model.addAttribute("capacity", capacity);
        String url = "crmSystem/cluePoolManager/user/saveClue";
        return url;
    }

    /**
     * 管理模块 -- 客户公海
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/customerManager/customerPoolForm")
    public String customerPoolForm(HttpServletRequest request, ModelMap model) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        model.addAttribute("isAdmin", CommonUtils.isAdmin(userAccount.getUserId()));
        String url = "crmSystem/customerManager/customerPoolForm";
        return url;
    }

    /**
     * 用户模块 -- 客户公海
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/customerManager/userCustomerPoolForm")
    public String userCustomerPoolForm(HttpServletRequest request, ModelMap model) {
        model.addAttribute("spiderUrl", this.spiderUrl);
        String url = "crmSystem/customerManager/user/userCustomerPoolForm";
        return url;
    }

    /**
     * 管理模块-客户公海-客户详情
     *
     * @param request
     * @param model
     * @param customerId 客户id
     * @return
     */
    @RequestMapping("/customerManager/customerDetail")
    public String customerHighSeasDetail(HttpServletRequest request, ModelMap model,
                                         @RequestParam(value = "customerId") String customerId) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        boolean rs = CommonUtils.isAdmin(userAccount.getUserId());
        if(!rs) {
            boolean b = customerService.selectCustomerSelf(customerId);
            if(!b) {
                return "crmSystem/error/error";
                //throw new BaseException("无权限查看");
            }
        }


        CustomerVO customer = customerPoolService.selectByCustomerId(customerId);
        if(2 == customer.getMemberErrorData()) {
            return "crmSystem/error/locking";
        }

        if(StringUtils.isBlank(customer.getEnterpriseExternalPhone())) {
            customer.setEnterpriseExternalPhone("");
        }

        model.addAttribute("customer", customer);


        Date namet = customer.getRegistrationTime();
        if (namet != null) {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
            String registrationDate = formatter.format(namet);
            model.addAttribute("registrationDate", registrationDate);
        } else {
            model.addAttribute("registrationDate", "");
        }



        Date membershipExpirationTmt = customer.getMembershipExpirationTm();
        if (membershipExpirationTmt != null) {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
            String membershipExpirationTm = formatter.format(membershipExpirationTmt);
            model.addAttribute("membershipExpirationTm", membershipExpirationTm);
        } else {
            model.addAttribute("membershipExpirationTm", "该客户不是会员");
        }

        Dictionary dictionary = new Dictionary();
        //企业状态  enterpriseState
        if (!StringUtils.isBlank(customer.getEnterpriseState())) {
            dictionary = customerPoolService.selectDictionaryByOne("1", customer.getEnterpriseState());
            judge("enterpriseState",dictionary,model);
        } else {
            model.addAttribute("enterpriseState", "");
        }

        //CAPITAL_TYPE("2","资本类型"),   capitalType
        if (!StringUtils.isBlank(customer.getCapitalType())) {
            dictionary = customerPoolService.selectDictionaryByOne("2", customer.getCapitalType());
            judge("capitalType",dictionary,model);
        } else {
            model.addAttribute("capitalType", "");
        }

        //	COMPANY_TYPE("3","公司类型"),	companyType
        if (!StringUtils.isBlank(customer.getCompanyType())) {
            dictionary = customerPoolService.selectDictionaryByOne("3", customer.getCompanyType());
            judge("companyType",dictionary,model);
        } else {
            model.addAttribute("companyType", "");
        }

        //	CLIENT_LEVEL("5","客户级别"), customerLevel
        if (!StringUtils.isBlank(customer.getCustomerLevel())) {
            dictionary = customerPoolService.selectDictionaryByOne("5", customer.getCustomerLevel());
            judge("customerLevel",dictionary,model);
        } else {
            model.addAttribute("customerLevel", "");
        }

        //	COMPANY_SIZE("6","公司规模"),   companySize
        if (!StringUtils.isBlank(customer.getCompanySize())) {
            dictionary = customerPoolService.selectDictionaryByOne("6", customer.getCompanySize());
            judge("companySize",dictionary,model);
        } else {
            model.addAttribute("companySize", "");
        }
        //	INDUSTRY("7","行业"),    industry
        if (!StringUtils.isBlank(customer.getIndustry())) {
            dictionary = customerPoolService.selectDictionaryByOne("7", customer.getIndustry());
            judge("industry",dictionary,model);
        } else {
            model.addAttribute("industry", "");
        }

        //	CUSTOMER_SOURCE("9","客户来源");  customerSource
        if (!StringUtils.isBlank(customer.getCustomerSource())) {
            dictionary = customerPoolService.selectDictionaryByOne("9", customer.getCustomerSource());
            judge("customerSource",dictionary,model);
        } else {
            model.addAttribute("customerSource", "");
        }
        //CUSTOMER_STATE("11","客户状态");  customerState
        if (!StringUtils.isBlank(customer.getCustomerState())) {
            dictionary = customerPoolService.selectDictionaryByOne("11", customer.getCustomerState());
            judge("customerState",dictionary,model);
        } else {
            model.addAttribute("customerState", "");
        }

        //目前状态  0: 未领取; 1: 已领取(我领取的客户);2: 已分配(分配给我的客户);3: 自建客户(用户模块我自建的客户)
        if(customer.getCurrentStatus() != null) {
            if (!StringUtils.isBlank(customer.getCurrentStatus().toString())) {
                if (customer.getCurrentStatus().toString().equals("0")) {
                    model.addAttribute("currentStatus", "未领取");
                } else if (customer.getCurrentStatus().toString().equals("1")) {
                    model.addAttribute("currentStatus", "已领取");
                } else if (customer.getCurrentStatus().toString().equals("2")) {
                    model.addAttribute("currentStatus", "已分配");
                } else {
                    model.addAttribute("currentStatus", "自建客户");
                }
            }
        } else {
            model.addAttribute("currentStatus", "");
        }

        //注册资本
        if (!StringUtils.isBlank(customer.getRegisteredCapital())) {
            model.addAttribute("registeredCapital", customer.getRegisteredCapital());
        } else {
            model.addAttribute("registeredCapital", "");
        }


        String url = "crmSystem/customerManager/customerDetail";
        //if (rs) {
        //return "crmSystem/customerManager/user/customerDetailUser";
        //} else {
        return url;
        //}
    }

    /**
     * 判断为空
     * @param name  字段名
     * @param dictionary 值
     * @param model 向前台返数据
     */
    public void judge(String  name,Dictionary dictionary,ModelMap model){
        if(dictionary == null) {
            model.addAttribute(name, "");
        }else{
            model.addAttribute(name, dictionary.getDictName());
        }
    }


    /**
     * 用户模块-客户公海-客户详情
     *
     * @param request
     * @param model
     * @param customerId 客户id
     * @return
     */
    @RequestMapping("/user/customerManager/customerDetail")
    public String userCustomerHighSeasDetail(HttpServletRequest request, ModelMap model,
                                             @RequestParam(value = "customerId") String customerId,
                                             @RequestParam(value = "hrefType", required = false) String hrefType,
                                             @RequestParam(value = "csd", required = false) String csd) {


        boolean b = customerService.selectCustomerSelf(customerId);
        //csd表示是客服，客户也可以查看客户详情
        if(!b&&!"csd".equals(csd)) {
            return "crmSystem/error/error";
            //throw new BaseException("无权限查看");
        }


        CustomerVO customer = customerPoolService.selectByCustomerId(customerId);
        if(2 == customer.getMemberErrorData()) {
            return "crmSystem/error/locking";
        }

        if(StringUtils.isBlank(customer.getEnterpriseExternalPhone())) {
            customer.setEnterpriseExternalPhone("");
        }

        model.addAttribute("customer", customer);
        model.addAttribute("hrefType", hrefType);

        Date namet = customer.getRegistrationTime();
        if (namet != null) {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
            String registrationDate = formatter.format(namet);
            model.addAttribute("registrationDate", registrationDate);
        } else {
            model.addAttribute("registrationDate", "");
        }



        Date membershipExpirationTmt = customer.getMembershipExpirationTm();
        if (membershipExpirationTmt != null) {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
            String membershipExpirationTm = formatter.format(membershipExpirationTmt);
            model.addAttribute("membershipExpirationTm", membershipExpirationTm);
        } else {
            model.addAttribute("membershipExpirationTm", "该客户不是会员");
        }


        Dictionary dictionary = new Dictionary();
        //企业状态  enterpriseState
        if (!StringUtils.isBlank(customer.getEnterpriseState())) {
            dictionary = customerPoolService.selectDictionaryByOne("1", customer.getEnterpriseState());
            judge("enterpriseState",dictionary,model);
        } else {
            model.addAttribute("enterpriseState", "");
        }

        //CAPITAL_TYPE("2","资本类型"),   capitalType
        if (!StringUtils.isBlank(customer.getCapitalType())) {
            dictionary = customerPoolService.selectDictionaryByOne("2", customer.getCapitalType());
            judge("capitalType",dictionary,model);
        } else {
            model.addAttribute("capitalType", "");
        }

        //	COMPANY_TYPE("3","公司类型"),	companyType
        if (!StringUtils.isBlank(customer.getCompanyType())) {
            dictionary = customerPoolService.selectDictionaryByOne("3", customer.getCompanyType());
            judge("companyType",dictionary,model);
        } else {
            model.addAttribute("companyType", "");
        }

        //	CLIENT_LEVEL("5","客户级别"), customerLevel
        if (!StringUtils.isBlank(customer.getCustomerLevel())) {
            dictionary = customerPoolService.selectDictionaryByOne("5", customer.getCustomerLevel());
            judge("customerLevel",dictionary,model);
        } else {
            model.addAttribute("customerLevel", "");
        }

        //	COMPANY_SIZE("6","公司规模"),   companySize
        if (!StringUtils.isBlank(customer.getCompanySize())) {
            dictionary = customerPoolService.selectDictionaryByOne("6", customer.getCompanySize());
            judge("companySize",dictionary,model);
        } else {
            model.addAttribute("companySize", "");
        }

        //	INDUSTRY("7","行业"),    industry
        if (!StringUtils.isBlank(customer.getIndustry())) {
            dictionary = customerPoolService.selectDictionaryByOne("7", customer.getIndustry());
            judge("industry",dictionary,model);
        } else {
            model.addAttribute("industry", "");
        }

        //	CUSTOMER_SOURCE("9","客户来源");  customerSource
        if (!StringUtils.isBlank(customer.getCustomerSource())) {
            dictionary = customerPoolService.selectDictionaryByOne("9", customer.getCustomerSource());
            judge("customerSource",dictionary,model);
        } else {
            model.addAttribute("customerSource", "");
        }

        //CUSTOMER_STATE("11","客户状态");  customerState
        if (!StringUtils.isBlank(customer.getCustomerState())) {
            dictionary = customerPoolService.selectDictionaryByOne("11", customer.getCustomerState());
            judge("customerState",dictionary,model);
        } else {
            model.addAttribute("customerState", "");
        }

        //目前状态 0: 未领取; 1: 已领取(我领取的客户);2: 已分配(分配给我的客户);3: 自建客户(用户模块我自建的客户)
        if(customer.getCurrentStatus() != null) {
            if (!StringUtils.isBlank(customer.getCurrentStatus().toString())) {
                if (customer.getCurrentStatus().toString().equals("0")) {
                    model.addAttribute("currentStatus", "未领取");
                } else if (customer.getCurrentStatus().toString().equals("1")) {
                    model.addAttribute("currentStatus", "已领取");
                } else if (customer.getCurrentStatus().toString().equals("2")) {
                    model.addAttribute("currentStatus", "已分配");
                } else {
                    model.addAttribute("currentStatus", "自建客户");
                }
            }
        }else{
            model.addAttribute("currentStatus", "");
        }

        System.out.println(customer.getRegisteredCapital());
        //注册资本
        if (!StringUtils.isBlank(customer.getRegisteredCapital())) {
            model.addAttribute("registeredCapital", customer.getRegisteredCapital());
        } else {
            model.addAttribute("registeredCapital", "");
        }

        String url = "crmSystem/customerManager/user/customerDetailUser";
        return url;
    }

    /**
     * 管理模块-客户公海详情-新增联系人
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/customerManager/addCustomerContactPerson")
    public String addCustomerContactPerson(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/customerManager/addCustomerContactPerson";
        return url;
    }

    /**
     * 给销总企微发消息的页面-订单产品退款
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/xzExamine")
    public String xzExamine(HttpServletRequest request, ModelMap model,
                      @RequestParam(value = "orderBackMoneyId") String orderBackMoneyId) {
        CustomerOrderBackMoney customerOrderBackMoney = customerProductOrderService.getCustomerOrderMoneyDetail(orderBackMoneyId);
        CustomerOrderBackMoneyExamine examine = customerProductOrderService.selectOrderBackMoneyExamine(customerOrderBackMoney.getOrderBackMoneyId());
        model.addAttribute("orderBackMoneyId", orderBackMoneyId);
        model.addAttribute("productOrderId", customerOrderBackMoney.getProductOrderId());
        model.addAttribute("status",examine.getXzExamineStatus());
        String url = "crmSystem/finance/backMoneyH5";
        return url;
    }

    /**
     * 给销总企微发消息的页面-余额退款
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/xzBalanceExamine")
    public String xzBalanceExamine(HttpServletRequest request, ModelMap model,
                            @RequestParam(value = "orderBackMoneyId") String orderBackMoneyId) {
        CustomerOrderBackMoney customerOrderBackMoney = customerProductOrderService.getCustomerOrderMoneyDetail(orderBackMoneyId);
        CustomerOrderBackMoneyExamine examine = customerProductOrderService.selectOrderBackMoneyExamine(customerOrderBackMoney.getOrderBackMoneyId());
        model.addAttribute("orderBackMoneyId", orderBackMoneyId);
        model.addAttribute("status",examine.getXzExamineStatus());
        String url = "crmSystem/finance/balanceBackMoneyH5";
        return url;
    }

    /**
     * 管理模块-客户池创建
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/customerManager/addCustomerPool")
    public String addCustomerPool(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/customerManager/addCustomerPool";
        return url;
    }

    /**
     * 客户池详情
     *
     * @param request
     * @param model
     * @param customerPoolId
     * @return
     */
    @RequestMapping("/customerManager/customerPoolDetail")
    public String customerPoolDetail(HttpServletRequest request, ModelMap model,
                                     @RequestParam String customerPoolId,//客户池ID
                                     @RequestParam String poolState,//启用&停用状态
                                     @RequestParam String nature//客户池类别
    ) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        model.addAttribute("customerPoolId", customerPoolId);
        model.addAttribute("poolState", poolState);
        model.addAttribute("nature", nature);
        model.addAttribute("isAdmin", CommonUtils.isAdmin(userAccount.getUserId()));
        String url = "crmSystem/customerManager/customerPoolDetail";
        return url;
    }

    /**
     * 我的线索池-线索清单-线索查看
     *
     * @param request
     * @param model
     * @param clueId  线索id
     * @return
     * @author wll
     */
    @RequestMapping("/cluePoolManager/user/clueDetail")
    public String userClueDetail(HttpServletRequest request, ModelMap model,
                                 @RequestParam String clueId) {
        model.addAttribute("clueId", clueId);
        ClueEditVO clueEditVO = clueService.selectClueByClueId(clueId);
        model.addAttribute("clue", clueEditVO);
//        model.addAttribute("clueId", clueId);
        String url = "crmSystem/cluePoolManager/user/userClueDetail";
        return url;
    }

    /**
     * 管理模块 -- 联系人管理
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/contactManager/contactForm")
    public String contactForm(HttpServletRequest request, ModelMap model) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        boolean b = CommonUtils.isAdmin(userAccount.getUserId());
        if(b) {
            model.addAttribute("admin", 0);
        }else{
            model.addAttribute("admin", 1);
        }

        String url = "crmSystem/contactManager/contactForm";
        return url;
    }

    /**
     * 用户模块 -- 联系人管理
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/contactManager/userContactForm")
    public String userContactForm(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/contactManager/user/userContactForm";
        return url;
    }

    /**
     * @param request
     * @param model
     * @param type    跟进方式：1-线上电话；2-拜访 3-微信 4-线下电话 5-邮箱 6-陪访
     * @param id      线索id/客户id
     * @param poolId  线索池id
     * @param source  从哪跳转到跟进页面（0：线索；1：客户）
     * @param singleProductCustomerId  单品客户id
     * @param customerType  客户类型  0企业客户 1个人客户
     * @param contactName  联系人姓名
     * @param contactInformation  联系方式
     * @return
     * @author wll
     * info 我的线索池-线索清单-线索跟进 / 用户模块-客户管理-我的客户-跟进
     */
    @RequestMapping("/contactManager/user/clueFollow")
    public String userClueFollow(HttpServletRequest request, ModelMap model,
                                 @RequestParam String type,
                                 @RequestParam String id,
                                 @RequestParam(value = "poolId", required = false) String poolId,
                                 @RequestParam String source,
                                 @RequestParam(value = "singleProductCustomerId", required = false) String singleProductCustomerId,
                                 @RequestParam(value = "customerType",required = false) String customerType,
                                 @RequestParam(value = "contactName",required = false) String contactName,
                                 @RequestParam(value = "contactInformation",required = false) String contactInformation) {
        String url = "crmSystem/contactManager/user/clueFollowOfflinePhone";
        model.addAttribute("type", type);
        model.addAttribute("id", id);
        model.addAttribute("poolId", poolId);
        model.addAttribute("source", source);
        model.addAttribute("singleProductCustomerId", singleProductCustomerId);
        model.addAttribute("customerType",customerType);
        model.addAttribute("contactName", contactName);
        model.addAttribute("contactInformation",contactInformation);
        return url;
    }

    /**
     * 跟进管理跳转新增跟进页面
     *
     * @param request
     * @param model
     * @param type    跟进方式：1-线上电话；2-拜访 3-微信 4-线下电话 5-邮箱 6-陪访
     * @param source  从哪跳转到跟进页面（0：线索；1：客户）
     * @return
     * @author wll
     */
    @RequestMapping("/followPlanManager/clueFollow")
    public String userClueFollow(HttpServletRequest request, ModelMap model,
                                 @RequestParam String type,
                                 @RequestParam String source) {
        String url = "crmSystem/followPlanManager/clueFollowOfflinePhone";
        model.addAttribute("type", type);
        model.addAttribute("source", source);
        return url;
    }

    /**
     * 用户系统--客户公海---跟进记录---跟进详情
     * @param model
     * @param followWay    跟进方式 1-线上电话；2-拜访 3-微信 4-线下电话 5-邮箱 6-陪访
     * @param clueFollowId 跟进记录主键
     * @param type 1:单品客户跟进详情
     * @return
     * @author yincuimei
     */
    @RequestMapping("/customerManager/customerFollowRecordDetail")
    public String customerFollowRecordDetail(ModelMap model, @RequestParam(value = "followWay", required = false) Integer followWay,
                                             @RequestParam(value = "clueFollowId", required = true) String clueFollowId,
                                             @RequestParam(value = "type", required = false) String type) {
        String url = "crmSystem/customerManager/customerFollowRecordDetail";
        //跟进详情信息
        ClueFollowVO clueFollowVO = clueFollowService.selectClueFollowVOById(clueFollowId,type,followWay);
        model.addAttribute("followWay", followWay);
        model.addAttribute("clueFollow", clueFollowVO);
        return url;
    }

    /**
     * 管理模块-客户清单-新增客户
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/customerManager/addCustomer")
    public String addCustomer(@RequestParam(value = "customerPoolId") String customerPoolId,//客户池ID
                              HttpServletRequest request, ModelMap model) {
        model.addAttribute("customerPoolId", customerPoolId);
        String url = "crmSystem/customerManager/addCustomer";
        return url;
    }

    /**
     * 用户模块-我的客户池
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/customerManager/myCustomerPool")
    public String myCustomerPool(HttpServletRequest request, ModelMap model) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        model.addAttribute("accountId",userAccount.getAccountId());
        model.addAttribute("esurl",ESurl);
        String url = "crmSystem/customerManager/user/myCustomerPool";
        return url;
    }

    /**
     * 产品管理--跳转到非会员产品列表(超级管理员页面)
     *
     * @param request
     * @return
     * @author ycm
     * @updater renshaorong
     * @param tag 用于标识用户端 or 管理端
     */
    @RequestMapping("/productManager/productForm")
    public String getProductList(HttpServletRequest request, ModelMap model, @RequestParam Integer tag) {
        model.addAttribute("tag",tag);
        String url = "crmSystem/productManager/productForm";
        return url;
    }

    /**
     * 产品管理--添加非会员产品(超级管理员页面)
     *
     * @param request
     * @param model
     * @param addOpportunityQO bs   产品返回标识  1商机列表新增商机触发-->新增产品  2联系人详情新增商机-->新增产品  3客户详情商机-->新增商机-->新增产品
     *                         没值是从产品列表新增跳转和菜单新增产品
     * @return
     */
    @RequestMapping("/productManager/addProduct")
    public String addProduct(HttpServletRequest request, ModelMap model, AddOpportunityQO addOpportunityQO) {
        if ("1".equals(addOpportunityQO.getProductBs())) {
            model.addAttribute("productBs", "1");//标识  1商机列表-->新增商机触发-->新增产品
        } else if ("2".equals(addOpportunityQO.getProductBs())) {
            model.addAttribute("productBs", "2");//标识  2联系人详情-->新增商机-->新增产品
        } else if ("3".equals(addOpportunityQO.getProductBs())) {
            model.addAttribute("productBs", "3");//标识  3客户详情商机-->新增商机-->新增产品
        }
        String url = "crmSystem/productManager/addProduct";
        return url;
    }

    /**
     * 产品管理--编辑非会员产品(超级管理员)->管理系统
     *
     * @return
     * @author ycm
     */
    @RequestMapping("/productManager/editProduct")
    public String editProduct(@RequestParam String customerProductId, ModelMap model) {
        model.addAttribute("customerProductId", customerProductId);//产品ID
        String url = "crmSystem/productManager/editProduct";
        return url;
    }

    /**
     * 产品管理--跳转到会员产品列表(超级管理员页面)->管理系统
     * @author ycm
     */
    @RequestMapping("/productManager/memberProductForm")
    public String getMemberProductList(ModelMap model) {
        model.put("jumpType","management");
        String url = "crmSystem/productManager/memberProductForm";
        return url;
    }

    /**
     * 产品管理--跳转到新增会员产品(超级管理员)->管理系统
     * @author ycm
     */
    @RequestMapping("/productManager/addMemberProduct")
    public String addMemberProduct() {
        String url = "crmSystem/productManager/addMemberProduct";
        return url;
    }

    /**
     * 产品管理--跳转到会员产品列表(用户系统)
     * @author ycm
     */
    @RequestMapping("/productManager/user/memberProductForm")
    public String getUserMemberProductList(ModelMap model) {
        model.put("jumpType","user");
        String url = "crmSystem/productManager/user/memberProductForm";
        return url;
    }

    /**
     * 产品管理--跳转到产品列表(普通管理员页面)
     *
     * @param request
     * @return
     * @author ycm
     */
    @RequestMapping("/productManager/user/productForm")
    public String getNormalProductList(HttpServletRequest request) {
        String url = "crmSystem/productManager/user/productForm";
        return url;
    }

    /**
     * 用户模块--客户池详情
     *
     * @param request
     * @param model
     * @param customerPoolId
     * @return
     */
    @RequestMapping("/customerManager/useCustomerPoolDetail")
    public String useCustomerPoolDetail(HttpServletRequest request, ModelMap model,
                                        @RequestParam String customerPoolId,//客户池ID
                                        @RequestParam String poolState,//启用&停用状态
                                        @RequestParam(required = false) String nature,//性质：1-全国公有池；2-分公司公有池；
                                        @RequestParam(required = false) String affiliatedCompanyId//全国公有池关联公司id
    ) {
        model.addAttribute("customerPoolId", customerPoolId);
        model.addAttribute("poolState", poolState);
        model.addAttribute("nature", nature);
        model.addAttribute("affiliatedCompanyId", affiliatedCompanyId);
        String url = "crmSystem/customerManager/user/useCustomerPoolDetail";
        return url;
    }

    /**
     * 用户模块-商机管理
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/opportunityManager/userOpportunityForm")
    public String userOpportunityForm(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/opportunityManager/user/userOpportunityForm";
        return url;
    }

    /**
     * 管理模块-商机管理
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/opportunityManager/opportunityForm")
    public String opportunityForm(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/opportunityManager/opportunityForm";
        return url;
    }

    /**
     * 商机管理-用户端-商机详情
     *
     * @param request
     * @param model
     * @param opportunityId 商机id
     * @return
     */
    @RequestMapping("/user/opportunityManager/userOpportunityDetail")
    public String userOpportunityDetail(HttpServletRequest request, ModelMap model, @RequestParam(value = "opportunityId") String opportunityId) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        OpportunityVO opportunityVo = opportunityService.opportunityDetail(opportunityId);
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");

        //预计签单时间
        Date namet = opportunityVo.getEstimatedSigningTime();
        if (namet != null) {
            String estimatedSigningTime = formatter.format(namet);
            model.addAttribute("estimatedSigningTime", estimatedSigningTime);
        } else {
            model.addAttribute("estimatedSigningTime", "");
        }


        //商机获取日期
        if (opportunityVo.getOpportunityAcquisitionTime() != null) {
            String opportunityAcquisitionTime = formatter.format(opportunityVo.getOpportunityAcquisitionTime());
            model.addAttribute("opportunityAcquisitionTime", opportunityAcquisitionTime);
        } else {
            model.addAttribute("opportunityAcquisitionTime", "");
        }


        //下次跟进时间
        if (opportunityVo.getNextFollowUpTime() != null) {
            String nextFollowUpTime = formatter.format(opportunityVo.getNextFollowUpTime());
            model.addAttribute("nextFollowUpTime", nextFollowUpTime);
        } else {
            model.addAttribute("nextFollowUpTime", "");
        }


        model.addAttribute("opportunity", opportunityVo);


        Dictionary dictionary = new Dictionary();
        //销售阶段  opportunityStatus
        dictionary = customerPoolService.selectDictionaryByOne("12", opportunityVo.getOpportunityStatus());
        model.addAttribute("opportunityStatus", dictionary.getDictName());


        opportunityVo.setOperatorName(userAccount.getUserName());

        String url = "crmSystem/opportunityManager/user/userOpportunityDetail";
        return url;
    }

    /**
     * 商机管理-管理端-商机详情
     * @param request
     * @param model
     * @param opportunityId 商机id
     * @return
     */
    @RequestMapping("/opportunityManager/opportunityDetail")
    public String opportunityDetail(HttpServletRequest request, ModelMap model, @RequestParam(value = "opportunityId") String opportunityId) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        OpportunityVO opportunityVo = opportunityService.opportunityDetail(opportunityId);
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");

        //预计签单时间
        Date namet = opportunityVo.getEstimatedSigningTime();
        if (namet != null) {
            String estimatedSigningTime = formatter.format(namet);
            model.addAttribute("estimatedSigningTime", estimatedSigningTime);
        } else {
            model.addAttribute("estimatedSigningTime", "");
        }


        //商机获取日期
        if (opportunityVo.getOpportunityAcquisitionTime() != null) {
            String opportunityAcquisitionTime = formatter.format(opportunityVo.getOpportunityAcquisitionTime());
            model.addAttribute("opportunityAcquisitionTime", opportunityAcquisitionTime);
        } else {
            model.addAttribute("opportunityAcquisitionTime", "");
        }


        //下次跟进时间
        if (opportunityVo.getNextFollowUpTime() != null) {
            String nextFollowUpTime = formatter.format(opportunityVo.getNextFollowUpTime());
            model.addAttribute("nextFollowUpTime", nextFollowUpTime);
        } else {
            model.addAttribute("nextFollowUpTime", "");
        }


        model.addAttribute("opportunity", opportunityVo);


        Dictionary dictionary = new Dictionary();
        //销售阶段  opportunityStatus
        dictionary = customerPoolService.selectDictionaryByOne("12", opportunityVo.getOpportunityStatus());
        model.addAttribute("opportunityStatus", dictionary.getDictName());

        opportunityVo.setOperatorName(userAccount.getUserName());

        boolean rs = CommonUtils.isAdmin(userAccount.getUserId());

        String url = "crmSystem/opportunityManager/opportunityDetail";
        if (rs) {
            return "crmSystem/opportunityManager/user/userOpportunityDetail";
        } else {
            return url;
        }
    }


    /**
     * 活动管理--跳转到活动列表(超级管理员页面)
     *
     * @param request
     * @return
     * @author lj
     */
    @RequestMapping("/activityManager/productActivityForm")
    public String getProductActivityList(HttpServletRequest request) {
        String url = "crmSystem/activityManager/productActivityForm";
        return url;
    }

    /**
     * 活动管理--添加活动(超级管理员页面)
     *
     * @param request
     * @return
     * @author lj
     */
    @RequestMapping("/activityManager/addProductActivity")
    public String addProductActivity(HttpServletRequest request) {
        String url = "crmSystem/activityManager/addProductActivity";
        return url;
    }

    /**
     * 活动管理--编辑活动(超级管理员页面)
     *
     * @param request
     * @return
     * @author lj
     */
    @RequestMapping("/activityManager/editProductActivity")
    public String editProductActivity(HttpServletRequest request, ModelMap model, @RequestParam String activityId) {
        CustomerProductActivity customerProductActivity = customerProductActivityService.selectProductActivityByPrimaryKey(activityId);
        model.addAttribute("activity", customerProductActivity);
        String url = "crmSystem/activityManager/editProductActivity";
        return url;
    }

    /**
     * 用户模块 -新增客户
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/customerManager/userAddCustomer")
    public String userAddCustomer(HttpServletRequest request, ModelMap model,
                                  AddOpportunityQO addOpportunityQO  //customerBs  客户返回标识 1商机列表新增商机-->新增客户
    ) {

        if ("1".equals(addOpportunityQO.getCustomerBs())) {
            model.addAttribute("customerBs", "1");
        }
        return "crmSystem/customerManager/user/userAddCustomer";
    }

    /**
     * 活动管理--添加赠品(超级管理员页面)
     *
     * @param request
     * @return
     * @author lj
     */
    @RequestMapping("/activityManager/addProductGift")
    public String addProductGift(HttpServletRequest request) {
        String url = "crmSystem/activityManager/addProductGift";
        return url;
    }

    /**
     * 活动管理--赠品列表(超级管理员页面)
     *
     * @param request
     * @return
     * @author lj
     */
    @RequestMapping("/activityManager/productGiftForm")
    public String productGiftForm(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/activityManager/productGiftForm";
        return url;
    }

    /**
     * 活动管理--编辑赠品(超级管理员页面)
     *
     * @param request
     * @return
     * @author lj
     */
    @RequestMapping("/activityManager/editProductGift")
    public String editProductGift(HttpServletRequest request, ModelMap model, @RequestParam String giftId) {
        CustomerProductGiftActivity customerProductGiftActivity = customerProductGiftActivityService.selectCustomerProductGiftActivityById(giftId);
        model.addAttribute("gift", customerProductGiftActivity);
        String url = "crmSystem/activityManager/editProductGift";
        return url;
    }


    /**
     * 用户模块-联系人管理-联系人详情
     *
     * @param request
     * @param model
     * @param contactId 联系人id
     * @return
     */
    @RequestMapping("/user/contactManager/contactDetail")
    public String userContactDetail(HttpServletRequest request, ModelMap model, @RequestParam(value = "contactId") String contactId) {
        //通过联系人id查询联系人详细信息
        ContactVO contact = contactService.selectContactDetailById(contactId);
        if (StringUtils.isBlank(contact.getAccessUrl())) {
            contact.setAccessUrl("/images/users/avatar-3.png");
        }
        model.addAttribute("contact", contact);
        if (StringUtils.isBlank(contact.getCustomerId())) {
            model.addAttribute("customerName", "个人客户");
        } else {
            model.addAttribute("customerName", contact.getCustomerName());
        }

        String url = "crmSystem/contactManager/user/userContactDetail";
        return url;
    }

    /**
     * 管理模块-联系人管理-联系人详情
     *
     * @param request
     * @param model
     * @param contactId 联系人id
     * @return
     */
    @RequestMapping("/contactManager/contactDetail")
    public String contactDetail(HttpServletRequest request, ModelMap model, @RequestParam(value = "contactId") String contactId) {
        //通过联系人id查询联系人详细信息
        ContactVO contact = contactService.selectContactDetailById(contactId);
        if (StringUtils.isBlank(contact.getAccessUrl())) {
            contact.setAccessUrl("/images/users/avatar-3.png");
        }
        model.addAttribute("contact", contact);
        if (StringUtils.isBlank(contact.getCustomerId())) {
            model.addAttribute("customerName", "个人客户");
        } else {
            model.addAttribute("customerName", contact.getCustomerName());
        }

        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        boolean rs = CommonUtils.isAdmin(userAccount.getUserId());

        String url = "crmSystem/contactManager/contactDetail";
        if (rs) {
            return "crmSystem/contactManager/user/userContactDetail";
        } else {
            return url;
        }
    }

    /**
     * 用户端-联系人管理-新增联系人
     *
     * @param request
     * @param addOpportunityQO customerId 客户id  contactBs 联系人返回标识 1客户详情-->新增商机-->新增联系人
     * @return
     * @author lj
     */
    @RequestMapping("/contactManager/addContact")
    public String addContact(HttpServletRequest request, ModelMap model, AddOpportunityQO addOpportunityQO) {
        if (!StringUtils.isBlank(addOpportunityQO.getCustomerId())) {
            if ("1".equals(addOpportunityQO.getContactBs())) {
                model.addAttribute("contactBs", "1");
            }
            model.addAttribute("customerId", addOpportunityQO.getCustomerId());
        } else {
            model.addAttribute("customerId", "");
        }

        String url = "crmSystem/contactManager/addContact";
        return url;
    }

    /**
     * 用户端-商机列表-新增商机
     * @param request
     * @param model
     * @param addOpportunityQO bs  1从商机列表的入口  3从客户详情的入口
     * @return
     */
    @RequestMapping("/opportunityManager/addOpportunity")
    public String addOpportunity(HttpServletRequest request, ModelMap model, AddOpportunityQO addOpportunityQO) {
        if ("1".equals(addOpportunityQO.getOpportunityBs())) {
            model.addAttribute("addOpportunityQO", addOpportunityQO);
        } else if ("3".equals(addOpportunityQO.getOpportunityBs())) {
            model.addAttribute("addOpportunityQO", addOpportunityQO);
        }

        String url = "crmSystem/opportunityManager/addOpportunity";
        return url;
    }

    /**
     * 用户端-新增联系方式
     *
     * @param request
     * @param model
     * @param addContactInformationQO contactId  联系人id
     *                                contactInformationBs  联系人返回标识 1联系管理列表新增联系方式-->返回联系人管理列表  2联系人详情新增联系方式-->返回联系人详情   3客户详情联系人新增联系方式-->客户详情
     * @return
     */
    @RequestMapping("/contactManager/addContactInformation")
    public String addContactInformation(HttpServletRequest request, ModelMap model, AddContactInformationQO addContactInformationQO) {
        model.addAttribute("addContactInformation", addContactInformationQO);
        String url = "crmSystem/contactManager/addContactInformation";
        return url;
    }

    /**
     * 合同管理(用户系统)-新建合同页面跳转
     * @param contractId 合同id
     * @param tag  1:新会员合同;2:非会员合同;3:活动合同
     * @param request
     * @return
     */
    @RequestMapping("/contractManager/userAddContract")
    public String addContract(HttpServletRequest request,
                              @RequestParam(value = "contractId", required = false) String contractId,
                              @RequestParam(value = "tag", required = false) String tag,
                              ModelMap model) {
        String url = "crmSystem/contractManager/user/addContract";
        if (!StringUtils.isBlank(contractId)) {
            CustomerContractEditVO customerContractEditVO = customerContractService.selectCustomerContractEditByContractId(contractId);
            model.put("contract", customerContractEditVO);

            //System.out.println("************" + JSONObject.toJSON(customerContractEditVO));
        }
        model.put("tag",tag);
        return url;
    }


    /**
     * 合同管理(管理系统)-合同列表页面跳转
     *
     * @return
     * @author yincuimei
     */
    @RequestMapping("/contractManager/managerContractForm")
    public String managerContractForm(ModelMap model) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        String url = "";
        if (CommonUtils.isAdmin(userAccount.getUserId())) {//超级管理员
            url = "crmSystem/contractManager/superContractForm";
        } else {//普通管理员
            model.addAttribute("companyId", userAccount.getCompanyId());
            url = "crmSystem/contractManager/contractForm";
        }
        return url;
    }

    /**
     * 合同列表-查看
     *
     * @param contractId ---合同ID
     * @param urlType    ---页面URL类型 (不为空的话是从用户系统跳过来的,审核结果为补充材料的合同详情页面需展示补充材料上传文件按钮)
     * @param jumpBs   1业绩明细进来的
     * @return
     * @author yincuimei
     */
    @RequestMapping("/contractManager/contractDetail")
    public String contractDetail(ModelMap model, @RequestParam String contractId, @RequestParam(value = "urlType", required = false) String urlType,
                                 @RequestParam(value = "jumpBs", required = false) String jumpBs) {
        String url = "crmSystem/contractManager/contractDetail";
        //合同详情
        CustomerContractDetailVO customerContractDetailVO = customerContractService.selectCustomerContractVODetail(contractId);
        model.put("customerContract", customerContractDetailVO);

        //回款情况
        FinanceProductOderInfoVO financeProductOderInfo = customerProductOrderService.financeProductOderInfo(customerContractDetailVO.getProductOrderId(), null);
        model.addAttribute("financeProductOderInfo", financeProductOderInfo);

        //审核详情
        ContractReviewVO contractReviewVO = contractReviewService.selectContractReviewFinally(contractId);
        model.addAttribute("contractReview", contractReviewVO);

        model.addAttribute("showFlag", false);

        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        if("houxinxue@nsrjlb.cn".equals(userAccount.getUserAccount())){
            model.addAttribute("ifHou", "1");
        }else{
            model.addAttribute("ifHou", "0");
        }

        //判断是否需要显示展示补充材料上传文件按钮
        if (contractReviewVO != null) {
            if (!StringUtils.isBlank(urlType) && "1".equals(customerContractDetailVO.getContractReviewStatus()) &&
                    "1".equals(contractReviewVO.getProcessResult())
            ) {
                model.addAttribute("showFlag", true);
            }
        }

        if(!StringUtils.isBlank(jumpBs)) {
            if("1".equals(jumpBs)) {
                model.addAttribute("jumpBs", jumpBs);
            }

        }

        return url;
    }

    /**
     * 合同列表-查看(管理端)
     *
     * @param contractId ---合同ID
     * @param urlType    ---页面URL类型 (不为空的话是从用户系统跳过来的,审核结果为补充材料的合同详情页面需展示补充材料上传文件按钮)
     * @return
     * @author yincuimei
     */
    @RequestMapping("/contractManager/contractDetailAdmin")
    public String contractDetailAdmin(ModelMap model, @RequestParam String contractId, @RequestParam(value = "urlType", required = false) String urlType) {

        //合同详情
        CustomerContractDetailVO customerContractDetailVO = customerContractService.selectCustomerContractVODetail(contractId);
        model.put("customerContract", customerContractDetailVO);

        //回款情况
        FinanceProductOderInfoVO financeProductOderInfo = customerProductOrderService.financeProductOderInfo(customerContractDetailVO.getProductOrderId(), null);
        model.addAttribute("financeProductOderInfo", financeProductOderInfo);

        //审核详情
        ContractReviewVO contractReviewVO = contractReviewService.selectContractReviewFinally(contractId);
        model.addAttribute("contractReview", contractReviewVO);

        model.addAttribute("showFlag", false);

        //判断是否需要显示展示补充材料上传文件按钮
        if (contractReviewVO != null) {
            if (!StringUtils.isBlank(urlType) && "1".equals(customerContractDetailVO.getContractReviewStatus()) &&
                    "1".equals(contractReviewVO.getProcessResult())
            ) {
                model.addAttribute("showFlag", true);
            }
        }


        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        boolean rs = CommonUtils.isAdmin(userAccount.getUserId());

        String url = "crmSystem/contractManager/contractDetailAdmin";
        if (rs) {
            return "crmSystem/contractManager/contractDetail";
        } else {
            return url;
        }
    }

    /**
     * 合同管理(用户系统)-合同列表页面跳转
     *
     * @return
     * @author yincuimei
     */
    @RequestMapping("/contractManager/userContractForm")
    public String contractForm(HttpServletRequest request) {
        String url = "crmSystem/contractManager/user/contractForm";
        return url;
    }

    /**
     * 客服部--审核管理---合同审核列表
     *
     * @return
     * @author yincuimei
     */
    @RequestMapping("/contractReviewManager/contractReviewForm")
    private String contractReviewForm() {
        String url = "crmSystem/contractReviewManager/contractReviewForm";
        return url;
    }

    /**
     * 客服部--审核管理---合同审核列表----合同审核
     *
     * @return
     * @author yincuimei
     */
    @RequestMapping("/contractReviewManager/contractReview")
    private String contractReview(ModelMap model, @RequestParam String contractId, @RequestParam String orderId) {
        model.put("contractId",contractId);
        model.put("orderId",orderId);
        String url = "crmSystem/contractReviewManager/contractReview";
        return url;
    }

    /**
     * 用户端-回款管理页面跳转
     *
     * @param request
     * @return
     */
    @RequestMapping("/receiptManager/userReceiptRecord")
    public String userReturnMoney(HttpServletRequest request) {
        String url = "crmSystem/finance/returnMoney";
        return url;
    }

    /**
     * 管理端-回款管理页面跳转
     *
     * @param request
     * @return
     */
    @RequestMapping("/receiptManager/receiptRecord")
    public String returnMoney(HttpServletRequest request) {
        String url = "crmSystem/returnMoney/returnMoney";
        return url;
    }

    /**
     * 管理模块 - 订单管理 - 订单列表页面跳转
     *
     * @param request
     * @return {@link {java.lang.String}}
     * @Author pym
     * @Date 2021/3/12 9:21
     */
    @RequestMapping("/orderManager/orderForm")
    public String orderForm(HttpServletRequest request,ModelMap model) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();

        String url = "";
        //超级管理员
        if (CommonUtils.isAdmin(userAccount.getUserId())) {
            url = "crmSystem/orderManager/superOrderForm";
        } else {//普通管理员
            url = "crmSystem/orderManager/orderForm";
        }
        model.put("companyId",userAccount.getCompanyId());
        return url;
    }

    /**
     * 用户模块 - 订单管理 - 订单列表页面跳转
     *
     * @param request
     * @return {@link {java.lang.String}}
     * @Author pym
     * @Date 2021/3/12 9:22
     */
    @RequestMapping("/orderManager/userOrderForm")
    public String userOrderForm(HttpServletRequest request) {
        String url = "crmSystem/orderManager/user/userOrderForm";
        return url;
    }

    /**
     * 订单管理-订单列表-订单详情
     *
     * @param request
     * @param model
     * @param productOrderId -产品订单表主键
     * @return {@link {java.lang.String}}
     * @Author pym
     * @Date 2021/3/15 14:11
     */
    @RequestMapping("/orderManager/orderDetail")
    public String orderDetail(HttpServletRequest request, ModelMap model, @RequestParam String productOrderId) {
        OrderDetailVO orderDetailVO = customerProductOrderService.selectOrderDetailVO(productOrderId);
        model.addAttribute("productOrderId", productOrderId);
        model.addAttribute("orderDetailVO", orderDetailVO);
        String url = "crmSystem/orderManager/orderDetail";
        return url;
    }

    /**
     * 用户模块-订单管理-订单列表-订单详情
     * @Author pym
     * @Date 2021/3/15 14:11
     * @param request
     * @param model
     * @param productOrderId -产品订单表主键
     * @return {@link {java.lang.String}}
     */
    /*@RequestMapping("/orderManager/userOrderDetail")
    public String userOrderDetail(HttpServletRequest request,ModelMap model, @RequestParam String productOrderId){
        OrderDetailVO orderDetailVO = customerProductOrderService.selectOrderDetailVO(productOrderId);
        model.addAttribute("productOrderId",productOrderId);
        model.addAttribute("orderDetailVO",orderDetailVO);
        String url = "crmSystem/orderManager/user/userOrderDetail";
        return url;
    }*/

    /**
     * 用户模块-个人信息
     *
     * @param request
     * @param model
     * @param userId 个人信息id
     * @param bs 1从账号管理的详细按钮进来的
     * @return
     */
    @RequestMapping("/user/userInfo")
    public String userInfo(HttpServletRequest request, ModelMap model, @RequestParam(value = "userId", required = false) String userId,
                           @RequestParam(value = "bs", required = false) String bs) {
        String url = "";
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        UserInfoVO userInfoVO = new UserInfoVO();

        boolean rs = CommonUtils.isAdmin(userAccount.getUserId());

        try{
            //通过userId查询个人信息
            if (!StringUtils.isBlank(userId)) {  //有值
                userInfoVO = userInfoService.getUserInfo(userId);
                model.addAttribute("editBs", "0");
                if(rs) {
                    model.addAttribute("editBs", "1");
                }
                //editBs   0从其他入口进来的 不做编辑  1从个人信息进来的
            } else {
                userInfoVO = userInfoService.getUserInfo(userAccount.getUserId());
                model.addAttribute("editBs", "1");
                if("1".equals(bs)) {
                    return "crmSystem/error/error";
                }
            }

            if(StringUtils.isBlank(userInfoVO.getAccessUrl())) {
                String osName = System.getProperties().getProperty("os.name");
                if (osName.equals("Linux")) {
                    File file = null;
                    //性别--0:男; 1:女
                    if(userInfoVO.getUserSex() != null) {
                        if(userInfoVO.getUserSex() == 0) {
                            //file = new File("/root/system/userimage/head-male.png");
                            file = new File("/root/crm/userimage/head-male.png");  //正式
                        }else if(userInfoVO.getUserSex() == 1) {
                            //file = new File("/root/system/userimage/head-female.png");
                            file = new File("/root/crm/userimage/head-female.png"); //正式
                        }
                    } else {
                        //file = new File("/root/system/userimage/head-neutral.png");
                        file = new File("/root/crm/userimage/head-neutral.png");  //正式
                    }
                    FileInputStream input = new FileInputStream(file);
                    MultipartFile multipartFile =new MockMultipartFile("file", file.getName(), "image/png", IOUtils.toByteArray(input));
                    String accessUrl = upload(multipartFile,userInfoVO.getUserId());
                    userInfoVO.setAccessUrl(accessUrl);
                }

            }

            model.addAttribute("userInfo", userInfoVO);

            //上级名称
            if (!StringUtils.isBlank(userInfoVO.getUserSuperiorId())) {
                UserInfo userInfo = userInfoService.selectUserInfoByPrivateKey(userInfoVO.getUserSuperiorId());
                model.addAttribute("userSuperiorName", userInfo.getUserName());
            } else {
                model.addAttribute("userSuperiorName", "");
            }

            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");

            //创建时间
            Date namet = userInfoVO.getCreateTm();
            if (namet != null) {
                String createTm = formatter.format(namet);
                model.addAttribute("createTm", createTm);
            } else {
                model.addAttribute("createTm", "");
            }
            url = "crmSystem/user/userInfo";
        }catch (Exception e){
            url = "crmSystem/error/error";
            log.error("error个人信息 {}",e);
        }

        return url;
    }

    public String upload(MultipartFile multipartFile,String userId) {
        String filePathStr = "";

        String fileName  = multipartFile.getOriginalFilename();
        // 文件类型
        String contentType = FilenameUtils.getExtension(fileName).toLowerCase();

        long time = System.currentTimeMillis();
        // 存储路径String

        //定义文件路径
        String filePath = FileUtil.generateFilePath(time,fileName, "");
        File file = new File(filePath);
        String accessUrl = "";
        try {

            // 保存文件
            multipartFile.transferTo(file);
            String crmIp = PathUtil.getCrmIp();//IP
            String port = PathUtil.getPort();//端口
            String accessPath = PathUtil.getAccessPath();
            //accessUrl="http://" + crmIp + ":" + port + accessPath + time + fileName;//本地运行项目
            accessUrl="http://" + crmIp + accessPath + time + fileName;//本地运行项目
            String fileId = fileUploadService.insertFileUpload(fileName,filePathStr,accessUrl,contentType);
            UserInfo userInfo = new UserInfo();
            userInfo.setUserId(userId);
            userInfo.setUploadId(fileId);
            userInfoService.updateUserInfo(userInfo);

            return accessUrl;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return accessUrl;
    }

    /**
     * 财务-订单详情跳转
     *
     * @param request
     * @param
     * @Author chaifuyou
     * @Date 2021/3/17 10:11
     */
    @RequestMapping("/finance/orderInfo")
    public String financeOrderInfo(
            HttpServletRequest request,
            ModelMap model,
            @RequestParam String productOrderId) {
        FinanceProductOderInfoVO vo = customerProductOrderService.financeProductOderInfo(productOrderId, null);
        CustomerContractDetailVO customerContractDetailVO = customerContractService.selectCustomerContractVODetail(vo.getContractId());
        UserAccount userAccount =  (UserAccount) SecurityUtils.getSubject().getPrincipal();//当前登录人信息
        if (Objects.nonNull(customerContractDetailVO)){
            //隐藏客户信息
            customerContractDetailVO.setContactName(null);
            customerContractDetailVO.setContactDetails(null);
            customerContractDetailVO.setCustomerEmail(null);
        }
        model.addAttribute("vo", vo);
        model.addAttribute("productOrderId", productOrderId);
        model.addAttribute("contractVO", customerContractDetailVO);
        model.addAttribute("deptId", userAccount.getDeptId());
        String url = "crmSystem/finance/orderInfo";
        return url;
    }

    /**
     * 财务端 - 到款统计跳转到款记录
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/finance/returnMoneyListByCompany")
    public String returnMoneyListByCompany(HttpServletRequest request,ModelMap model) {
        String url = "crmSystem/finance/returnMoneyListByCompany";
        return url;
    }

    /**
     * 财务-订单详情跳转
     *
     * @param request
     * @param
     * @Author chaifuyou
     * @Date 2021/3/17 10:11
     */
    @RequestMapping("/finance/orderInfoByNumber")
    public String financeOrderInfoByNumber(HttpServletRequest request,ModelMap model, @RequestParam String productOrderNumber){
        CustomerProductOrderVO orderVO = customerProductOrderService.selectCustomerProductOrderByNumber(productOrderNumber);
        if (Objects.nonNull(orderVO)){
            FinanceProductOderInfoVO vo = customerProductOrderService.financeProductOderInfo(orderVO.getProductOrderId(),null);
            CustomerContractDetailVO customerContractDetailVO = customerContractService.selectCustomerContractVODetail(orderVO.getContractId());
            if (Objects.nonNull(customerContractDetailVO)){
                //隐藏客户信息
                customerContractDetailVO.setContactName(null);
                customerContractDetailVO.setContactDetails(null);
                customerContractDetailVO.setCustomerEmail(null);
            }
            model.addAttribute("vo", vo);
            model.addAttribute("contractVO", customerContractDetailVO);
            model.addAttribute("productOrderId", orderVO.getProductOrderId());
        }
        String url = "crmSystem/finance/orderInfo";
        return url;
    }

    /**
     * super财务-产品补发跳转
     * @param request
     * @Author chaifuyou
     * @Date 2021/8/6 08:24
     */
    @RequestMapping("/finance/anewSendFinishProduct")
    public String anewSendFinishProduct(HttpServletRequest request) {
        String url = "crmSystem/finance/anewSendFinishProduct";
        return url;
    }

    /**
     * 财务-订单列表跳转
     *
     * @param request
     * @param
     * @Author chaifuyou
     * @Date 2021/3/19 08:24
     */
    @RequestMapping("/finance/orderForm")
    public String financeOrderForm(HttpServletRequest request) {
        String url = "crmSystem/finance/orderForm";
        return url;
    }

    /**
     * 财务-产品提成发放跳转
     * @param request
     * @Author chaifuyou
     * @Date 2021/7/30 08:24
     */
    @RequestMapping("/finance/productRoyalty")
    public String productRoyalty(HttpServletRequest request) {
        String url = "crmSystem/finance/productRoyalty";
        return url;
    }



    /**
     * 财务-回款录入跳转
     * @param request
     * @param
     * @Author chaifuyou
     * @Date 2021/3/23 16:24
     */
    @RequestMapping("/finance/inputPayment")
    public String financeInputPayment(HttpServletRequest request, ModelMap model, @RequestParam String productOrderId) {
        model.addAttribute("productOrderId", productOrderId);
        String url = "crmSystem/finance/inputPayment";
        return url;
    }

    /**
     * 管理端-优惠券管理
     * @param request
     * @param
     * @Author chaifuyou
     * @Date 2021/3/23 16:24
     */
    @RequestMapping("/activityManager/discountCoupon")
    public String discountCoupon(HttpServletRequest request, ModelMap model) {
        model.addAttribute("esurl", ESurl);
        String url = "crmSystem/activityManager/discountCoupon";
        return url;
    }

    /**
     * 管理端-优惠券管理
     * @param request
     * @param
     * @Author chaifuyou
     * @Date 2021/3/23 16:24
     */
    @RequestMapping("/systemManager/importData")
    public String importData(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/systemManager/importData";
        return url;
    }

    /**
     * 管理端-发票开票管理
     * @param request
     * @param
     * @Author chaifuyou
     * @Date 2021/7/22 10:24
     */
    @RequestMapping("/systemManager/invoiceManagement")
    public String invoiceManagement(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/systemManager/invoiceManagement";
        return url;
    }

    /**
     * 财务端-发票开票管理
     * @param request
     * @param
     * @Author chaifuyou
     * @Date 2021/7/22 10:24
     */
    @RequestMapping("/finance/invoiceManagement")
    public String financeInvoiceManagement(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/finance/invoiceManagement";
        return url;
    }

    /**
     * 用户端-导入日志跳转
     *
     * @param request
     * @param
     * @Author chaifuyou
     * @Date 2021/6/30 10:11
     */
    @GetMapping("/workOrderManager/user/importLog")
    public String userImportLog( HttpServletRequest request){
        String url = "crmSystem/workOrderManager/user/importFailureLog";
        return url;
    }

    /**
     * 管理端-导入日志跳转
     *
     * @param request
     * @param
     * @Author chaifuyou
     * @Date 2021/6/30 10:11
     */
    @GetMapping("/workOrderManager/importLog")
    public String workOrderManagerImportLog( HttpServletRequest request,ModelMap model){
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();//当前登录人信息
        boolean b = CommonUtils.isAdmin(userAccount.getUserId());
        model.addAttribute("isSuper",b);
        String url = "crmSystem/workOrderManager/importFailureLog";
        return url;
    }


    /**
     * 创建权限组跳转接口
     *
     * @param request
     * @return {@link {java.lang.String}}
     * @Author pym
     * @Date 2021/3/23 11:33
     */
    @GetMapping("/permissionManager/addPermissionGroup")
    public String addPermissionGroup(HttpServletRequest request) {
        String url = "crmSystem/permissionManager/addPermissionGroup";
        return url;
    }

    /**
     * 权限组名单跳转接口
     *
     * @param request
     * @return {@link {java.lang.String}}
     * @Author pym
     * @Date 2021/3/23 11:34
     */
    @GetMapping("/permissionManager/permissionList")
    public String permissionList(HttpServletRequest request) {
        String url = "crmSystem/permissionManager/permissionList";
        return url;
    }

    /**
     * 未联系人详情
     *
     * @param request
     * @param model
     * @return
     */
    @GetMapping("/remind/forgetCustomer")
    public String remind(HttpServletRequest request,
                         ModelMap model,
                         @RequestParam String dataType) {
        model.addAttribute("dataType", dataType);
        String url = "crmSystem/customerManager/forgetRemindDetail";
        return url;
    }

    /**
     * 管理端-跟进计划
     *
     * @param request
     * @return
     */
    @GetMapping("/followPlanManager/followPlanForm")
    public String followPlanForm(HttpServletRequest request,ModelMap modelMap) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();//获取登录人信息
        modelMap.addAttribute("isAdmin", CommonUtils.isAdmin(userAccount.getUserId()));
        String url = "crmSystem/followPlanManager/followPlanForm";
        return url;
    }

    /**
     * 用户端-跟进计划
     *
     * @param request
     * @return
     */
    @GetMapping("/followPlanManager/user/followPlanForm")
    public String userFollowPlanForm(HttpServletRequest request) {
        String url = "crmSystem/followPlanManager/user/followPlanForm";
        return url;
    }

    /**
     * 用户端-跟进记录
     *
     * @param request
     * @return
     */
    @GetMapping("/followPlanManager/user/followPlanLogForm")
    public String userFollowPlanLogForm(HttpServletRequest request) {
        String url = "crmSystem/followPlanManager/user/followPlanLogForm";
        return url;
    }

    /**
     * 管理端-跟进记录
     *
     * @param request
     * @return
     */
    @GetMapping("/followPlanManager/followPlanLogForm")
    public String followPlanLogForm(HttpServletRequest request, ModelMap modelMap) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();//获取登录人信息
        modelMap.addAttribute("isAdmin", CommonUtils.isAdmin(userAccount.getUserId()));
        String url = "crmSystem/followPlanManager/followPlanLogForm";
        return url;
    }


    /**
     * 呼叫中心-用户跳转
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/callCenter/callCenterUserForm")
    public String callCenterUserForm(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/callcenter/user/callCenterUserForm";
        return url;
    }


    /**
     * 呼叫中心-管理跳转
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/callCenter/callCenterManagerForm")
    public String callCenterManagerForm(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/callcenter/callCenterManagerForm";
        return url;
    }

    /**
     * @param request
     * @param model
     * @param type               跟进方式：1-线上电话；2-拜访 3-微信 4-线下电话 5-邮箱 6-陪访
     * @param bs                 0-联系人列表  1-联系人详情
     * @param customerId         客户id
     * @param contactId          联系人id
     * @param contactName        联系人姓名
     * @param contactInformation 联系方式
     * @return
     * @author wll
     * info 联系人管理-联系人列表-跟进
     */
    @RequestMapping("/contactManager/user/contactFollow")
    public String contactFollow(HttpServletRequest request, ModelMap model,
                                @RequestParam String type,
                                @RequestParam String bs,
                                @RequestParam(value = "customerId", required = false) String customerId,
                                @RequestParam(value = "contactId", required = false) String contactId,
                                @RequestParam(value = "contactName", required = false) String contactName, //标识 0从联系人跳过来的,自动填充联系人
                                @RequestParam(value = "contactInformation", required = false) String contactInformation //标识 0从联系人跳过来的,自动填充联系方式
    ) {
        String url = "crmSystem/contactManager/contactFollow";
        model.addAttribute("type", type);
        model.addAttribute("bs", bs);
        model.addAttribute("customerId", customerId);
        model.addAttribute("contactId", contactId);
        model.addAttribute("contactName", contactName);
        model.addAttribute("contactInformation", contactInformation);
        return url;
    }


    /**
     * 财务-提成发放订单列表跳转
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/finance/royaltyOrderForm")
    public String financeRoyaltyOrderForm(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/finance/royaltyOrderForm";
        return url;
    }

    /**
     * 财务-提成发放頁面跳轉
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/finance/sendRoyalty")
    public String financeSendRoyalty(HttpServletRequest request, ModelMap model, @RequestParam String orderId) {
        FinanceProductOderInfoVO vo = customerProductOrderService.financeProductOderInfo(orderId, null);
        Date sendTime = sendRoyaltyService.getMaxCreateTime(orderId);
        model.addAttribute("vo", vo);
        model.addAttribute("orderId", orderId);
        if (Objects.nonNull(sendTime)) {
            model.addAttribute("sendTime", DateUtil.formatDateTime(sendTime));
        } else {
            model.addAttribute("sendTime", null);
        }
        String url = "crmSystem/finance/sendRoyalty";
        return url;
    }


    /**
     * 呼叫中心（管理段）-详情跳转
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/callCenter/callCenterDetails")
    public String callCenterDetails(HttpServletRequest request, ModelMap model,
                                    @RequestParam(value = "formId", required = false) String formId,
                                    @RequestParam(value = "contactId", required = false) String contactId,
                                    @RequestParam(value = "dateType", required = false) String dateType,
                                    @RequestParam(value = "bs", required = false) Integer bs) {
        model.addAttribute("bs", bs);
        model.addAttribute("formId", formId);
        model.addAttribute("contactId", contactId);
        model.addAttribute("dateType", dateType);
        String url = "crmSystem/callcenter/callCenterDetailsForm";
        return url;
    }

    /**
     * 测试一对一聊天
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/index")
    public String index(HttpServletRequest request, ModelMap model) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        model.addAttribute("accountId", userAccount.getAccountId());
        model.addAttribute("userName", userAccount.getUserName());
        String url = "crmSystem/contactManager/index";
        return url;
    }

    /**
     * 账号管理页面跳转
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/systemManager/accountManagementForm")
    public String userAccount(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/user/userAccount";
        return url;
    }

    /**
     * 管理端-商机管理-商机分析
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/opportunityManager/opportunityAnalysis")
    public String opportunityAnalysis(HttpServletRequest request, ModelMap model) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        boolean rs = CommonUtils.isAdmin(userAccount.getUserId());
        String bs = "1";
        if(rs) {
            bs = "0";
        }
        //bs 0超管 1普通管理员
        model.addAttribute("bs", bs);
        String url = "crmSystem/opportunityManager/opportunityAnalysisForm";

        return url;
    }

    /**
     * 用户端-商机管理-商机分析
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/opportunityManager/userOpportunityAnalysis")
    public String userOpportunityAnalysis(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/opportunityManager/user/userOpportunityAnalysisForm";
        return url;
    }

    /**
     * 线上跟进-呼叫中心
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/callCenter")
    public String callCenter(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/customerManager/user/callCenter/TelOcx";
        return url;
    }

    /**
     * 线上跟进-呼叫中心-会议
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/callCenter/TelMeeting")
    public String TelMeeting(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/customerManager/user/callCenter/TelMeeting";
        return url;
    }

    /**
     * 用户端-跟进计划-详情跳转
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/followPlanManager/followPlanInfo")
    public String followPlanInfo(HttpServletRequest request, ModelMap model, String customerId,String planDate) {
        model.addAttribute("customerId",customerId);
        model.addAttribute("planDate",planDate);
        String url = "crmSystem/followPlanManager/user/followPlanInfo";
        return url;
    }


    /**
     * 管理端-跟进计划-详情跳转
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/followPlanManager/sys/followPlanInfo")
    public String sysFollowPlanInfo(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/followPlanManager/followPlanInfo";
        return url;
    }

    /***
     * @Description:会员管理-会员卡管理页面跳转
     * @Param:
     * @Author: luojie
     * @Date: 2021/4/7 16:20
     */
    @RequestMapping("/memberManager/user/membershipCardManager")
    public String membershipCardManager(HttpServletRequest request){
        String url = "crmSystem/memberManager/user/membershipCardManager";
        return url;
    }

    /**
     * 用户端-客户分析跳转
     *
     * @param request
     * @return
     */
    @RequestMapping("/statisticsManager/user/analyseCustomerForm")
    public String analyseCustomerForm(HttpServletRequest request){
        String url = "crmSystem/statisticsManager/user/analyseCustomerForm";
        return url;
    }

    /**
     * 管理端-客户分析跳转
     *
     * @param request
     * @return
     */
    @RequestMapping("/statisticsManager/analyseCustomerForm")
    public String statisticsManagerAnalyseCustomerForm(HttpServletRequest request){
        String url = "crmSystem/statisticsManager/analyseCustomerForm";
        return url;
    }

    /**
     * 跳转移交资料页面
     * @Author renshaorong
     * @Date 2021/4/9
     *
     * @update 增加用户名参数，以便展示
     * @param request
     * @return
     */
    @RequestMapping("/user/moveData")
    public String moveData(HttpServletRequest request,ModelMap model,String accountId, String userName){
        model.addAttribute("accountId",accountId);
        model.addAttribute("userName",userName);
        String url = "crmSystem/user/moveData";
        return url;
    }


    /**
     * 产品详情查看（用户端）
     * @Author yuanyunfeng
     * @Date 2021/4/13
     * @param request
     * @return
     */
    @RequestMapping("/customerProduct/detail/info")
    public String productDetailInfo(HttpServletRequest request,ModelMap model,String memberProductId){
        model.addAttribute("memberProductId",memberProductId);
        String url = "crmSystem/productManager/productDetail";
        return url;
    }


    /**
     * @Description:产品详情查看（服务项管理）
     * @Author: yuanyunfeng
     * @Date: 2021/4/16 10:41
     * @Param:
     * @Return:
     */
    @RequestMapping("/customerProduct/service/info")
    public String productServiceInfo(HttpServletRequest request,ModelMap model,String memberProductId){
        model.addAttribute("memberProductId",memberProductId);
        String url = "crmSystem/productManager/productServiceDetail";
        return url;
    }

    /**
     * 跳转统计图表页面
     * @Author renshaorong
     * @Date 2021/4/12
     * @param request
     * @return
     */
    @RequestMapping("/follow/followChart")
    public String followChart(HttpServletRequest request,ModelMap model){
        String url = "crmSystem/followPlanManager/followChart";
        return url;
    }
    /**
     * 跳转统计图表页面
     * @Author renshaorong
     * @Date 2021/4/12
     * @param request
     * @return
     */
    @RequestMapping("follow/adminFollowChart")
    public String adminFollowChart(HttpServletRequest request,ModelMap model){
        String url = "crmSystem/followPlanManager/admin/adminFollowChart";
        return url;
    }

    /**
     * 管理端-产品分析跳转
     * @Author chaifuyou
     * @Date 2021/4/16
     * @param request
     * @return
     */
    @RequestMapping("/productManager/productAnalyse")
    public String productAnalyse(HttpServletRequest request){
        String url = "crmSystem/productManager/productAnalyse";
        return url;
    }

    /**
     * 用户端-产品分析跳转
     * @Author chaifuyou
     * @Date 2021/4/16
     * @param request
     * @return
     */
    @RequestMapping("/productManager/user/productAnalyse")
    public String userProductAnalyse(HttpServletRequest request){
        String url = "crmSystem/productManager/user/productAnalyse";
        return url;
    }

    /**
     * 用户端-论坛跳转
     * @Author chaifuyou
     * @Date 2021/5/25
     * @param request
     * @return
     */
    @RequestMapping("/userForumManager/userForum")
    public String userForum(HttpServletRequest request,ModelMap modelMap){
        UserForumInfoVO userForumVO = userForumService.selectLoginUserForumInfo(null);
        modelMap.addAttribute("userImg",userForumVO.getUserImg());
        modelMap.addAttribute("attentionCount",userForumVO.getAttentionCount());
        modelMap.addAttribute("fansCount",userForumVO.getFansCount());
        modelMap.addAttribute("forumCount",userForumVO.getForumCount());
        modelMap.addAttribute("userName",userForumVO.getUserName());
        modelMap.addAttribute("userLevel",userForumVO.getUserLevel());
        modelMap.addAttribute("userLevel",userForumVO.getUserLevel());
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();//当前登录人信息
        modelMap.addAttribute("accountId",userAccount.getAccountId());
        String url = "crmSystem/userForumManager/userForum";
        return url;
    }

    /**
     * 跳转呼叫报表页面
     * @Author renshaorong
     * @Date 2021/4/16
     * @param request
     * @return
     */
    @RequestMapping("/callForm/report")
    public String callFormReport(HttpServletRequest request,ModelMap model){
        String url = "crmSystem/callcenter/user/callReport";
        return url;
    }

    /**
     * 联系人报表-用户端
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/user/contact/contactReport")
    public String contactReport(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/contactManager/user/userContactAnalysisReport";
        return url;
    }

    /**
     * (管理系统)->报表统计->新会员分析
     * @return
     * @author yincuimei
     */
    @RequestMapping("/reportStatistics/newMemberAnalyse")
    public String newMemberAnalyse(){
        String url = "crmSystem/reportStatistics/newMemberAnalyse";
        return url;
    }

    /**
     * 用户模块 -新增个人客户
     * @Author pym
     * @Date  2021/4/19 10:45
     * @param request
     * @param model
     * @return {@link {java.lang.String}}
     */
    @RequestMapping("/customerManager/addIndividualCustomer")
    public String addIndividualCustomer(HttpServletRequest request, ModelMap model) {
        return "crmSystem/customerManager/user/addIndividualCustomer";
    }



    /**
     * 系统设置
     * @author chaifuyou
     * @date 2021/4/20 13:58
     * @param
     * @return
     */
    @RequestMapping("/systemManager/systemParameterSetting")
    public String systemParameterSetting(HttpServletRequest request, ModelMap model,String type) {
        return "crmSystem/systemManager/systemParameterSetting";
    }

    /**
     * 系统收回客户记录页面跳转
     * @author chaifuyou
     * @date 2021/4/20 13:58
     * @param
     * @return
     */
    @RequestMapping("/systemManager/sysReturnCustomerLog")
    public String sysReturnCustomerLog(HttpServletRequest request, ModelMap model,String type) {
        return "crmSystem/systemManager/sysReturnCustomerLog";
    }

    /**
     * 管理端-项目管理
     * @author chaifuyou
     * @date 2021/7/26 15:39
     * @return
     */
    @RequestMapping("/systemManager/projectManagement")
    public String sysProjectManagement(HttpServletRequest request, ModelMap model) {
        return "crmSystem/systemManager/projectManagement";
    }

    /**
     * 跳转申请开票页面
     * @author chaifuyou
     * @date 2021/4/25 16:39
     * @param type 纸质发票 1 电子发票 2
     * @param orderId 订单id
     * @return
     */
    @RequestMapping("/orderManager/user/applyInvoice")
    public String userApplyInvoice(HttpServletRequest request, ModelMap model,String type,String orderId) {
        ApplyInvoiceOrderInfoVO vo=customerProductOrderService.getApplyInvoiceOrderInfo(type,orderId,null);
        model.addAttribute("vo",vo);
        return "crmSystem/orderManager/user/applyInvoice";
    }

    /**
     * 用户端-跳转退款记录
     * @author chaifuyou
     * @date 2021/4/27 10:39
     * @return
     */
    @RequestMapping("/orderManager/user/backMoney")
    public String userBackMoney(HttpServletRequest request, ModelMap model,String type,String orderId) {
        return "crmSystem/orderManager/user/backMoney";
    }

    /**
     * 财务端-退款记录
     * @author chaifuyou
     * @date 2021/7/23 15:39
     * @return
     */
    @RequestMapping("/finance/backMoney")
    public String backMoney(HttpServletRequest request, ModelMap model) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();//当前登录人信息
        String deptId = userAccount.getDeptId();
        boolean rs = CommonUtils.isAdmin(userAccount.getUserId());

        //分总
        if("5".equals(userAccount.getDeptId())) {
            deptId = "0";
        }
        //客服
        if("6".equals(userAccount.getDeptId())) {
            deptId = "1";
        }
        //销总
        if("7".equals(userAccount.getDeptId())) {
            deptId = "2";
        }
        //网络部
        if(rs) {
            deptId = "3";
        }
        //财务
        if("3".equals(userAccount.getDeptId()) || "4".equals(userAccount.getDeptId())) {
            deptId = "4";
        }
        model.addAttribute("dept",deptId);
        return "crmSystem/finance/backMoney";
    }

    /**
     * 财务端-跳转审批开票页面
     * @author chaifuyou
     * @date 2021/4/25 16:39
     * @param orderId 订单id
     * @return
     */
    @RequestMapping("/finance/issueInvoice")
    public String financeIssueInvoice(HttpServletRequest request, ModelMap model,String orderId,String chsCustomerOrderInvoiceId) {
        ApplyInvoiceOrderInfoVO vo=customerProductOrderService.getApplyInvoiceOrderInfo(null,orderId,chsCustomerOrderInvoiceId);
        vo.setChsCustomerOrderInvoiceId(chsCustomerOrderInvoiceId);
        model.addAttribute("vo",vo);
        return "crmSystem/finance/issueInvoice";
    }

    /**
     * 财务端-流水管理
     * @author chaifuyou
     * @date 2021/7/23 15:39
     * @return
     */
    @RequestMapping("/finance/serialForm")
    public String serialForm(HttpServletRequest request, ModelMap model) {
        return "crmSystem/finance/serialForm";
    }

    /**
     * @author  yuanyunfeng
     * @Description 财务端 - 流水关联页面
     * @date  2021/11/10 17:01
     * @Param [request, model]
     * @return java.lang.String
     **/
    @RequestMapping("/finance/relate")
    public String serialRelate(HttpServletRequest request, ModelMap model) {
        return "crmSystem/finance/serialRelate";
    }


    /**
     * 财务端-银行流水查看
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/finance/query")
    public String bankFlowQuery(HttpServletRequest request, ModelMap model) {
        return "crmSystem/finance/serialQuery";
    }

    /**
     * 财务端-流水回款详情
     * @author yuanyunfeng
     * @date 2021/7/30 14:05
     * @return
     */
    @RequestMapping("/finance/serialDetail")
    public String serialDetail(HttpServletRequest request, ModelMap model) {
        return "crmSystem/finance/serialDetail";
    }



    /**
     * 财务端-项目管理
     * @author chaifuyou
     * @date 2021/7/26 15:39
     * @return
     */
    @RequestMapping("/finance/projectManagement")
    public String projectManagement(HttpServletRequest request, ModelMap model) {
        return "crmSystem/finance/projectManagement";
    }

    /**
     * 用户端-会员报表分析
     * @author chaifuyou
     * @date 2021/4/26 10:39
     * @return
     */
    @RequestMapping("/customerManager/vipCustomerAnalyse")
    public String userOrderAnalyse(HttpServletRequest request, ModelMap model) {
        VipCustomerAnalyseVO vo =customerService.getVipCustomerCount();
        model.addAttribute("vo",vo);
        return "crmSystem/customerManager/vipCustomerAnalyse";
    }

    /**
     * 管理端-发票管理列表跳转
     * @author chaifuyou
     * @date 2021/4/26 10:39
     * @return
     */
    @RequestMapping("/invoiceManager/invoiceForm")
    public String invoiceForm(HttpServletRequest request, ModelMap model) {
        return "crmSystem/invoiceManager/invoiceForm";
    }

    /**
     * 用户端-发票管理列表跳转
     * @author chaifuyou
     * @date 2021/4/26 10:39
     * @return
     */
    @RequestMapping("/invoiceManager/user/invoiceForm")
    public String userInvoiceForm(HttpServletRequest request, ModelMap model) {
        return "crmSystem/invoiceManager/user/invoiceForm";
    }

    /**
     * 财务-发票管理列表跳转
     * @author chaifuyou
     * @date 2021/4/28 15:39
     * @return
     */
    @RequestMapping("/finance/invoiceForm")
    public String financeInvoiceForm(HttpServletRequest request, ModelMap model) {
        return "crmSystem/finance/invoiceForm";
    }

    /**
     * 税盘管理跳转
     * @author chaifuyou
     * @date 2021/4/28 16:10
     * @return
     */
    @RequestMapping("/systemManager/taxDiscManager")
    public String taxDiscSetting(HttpServletRequest request, ModelMap model) {
        return "crmSystem/systemManager/taxDiscManager/taxDiscFrom";
    }

    /**
     * 客户管理-客户充值跳转
     * @author chaifuyou
     * @date 2021/4/30 8:40
     * @return
     */
    @RequestMapping("/customerManager/customerPayForm")
    public String customerPayForm(HttpServletRequest request, ModelMap model) {
        return "crmSystem/customerManager/user/customerPayForm";
    }

    /**
     * 财务 - 客户管理-客户充值跳转
     * @author chaifuyou
     * @date 2021/4/30 8:40
     * @return
     */
    @RequestMapping("/finance/customerPayForm")
    public String financeCustomerPayForm(HttpServletRequest request, ModelMap model) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();//当前登录人信息
        model.addAttribute("deptId",userAccount.getDeptId());
        SysCompany sysCompany = sysCompanyService.selectSysCompanyById(userAccount.getCompanyId());
        if (Objects.nonNull(sysCompany)){
            model.addAttribute("companyName",sysCompany.getTrueCompanyName());
        }
        return "crmSystem/finance/customerPayForm";
    }

    /**
     * 客户转入可跳转
     * @author chaifuyou
     * @date 2021/5/6 11:39
     * @return
     */
    @RequestMapping("/customerManager/customerShiftWallet")
    public String customerShiftWallet(HttpServletRequest request, ModelMap model) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();//当前登录人信息
        model.addAttribute("deptId",userAccount.getDeptId());
        return "crmSystem/customerManager/customerShiftWallet";
    }

    /**
     * 分公司财务 - 到款统计列表跳转
     * @author chaifuyou
     * @date 2021/7/14 11:39
     * @return
     */
    @RequestMapping("/finance/statReturnMoney")
    public String statReturnMoney(HttpServletRequest request, ModelMap model) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();//当前登录人信息
        model.addAttribute("deptId",userAccount.getDeptId());
        return "crmSystem/finance/statReturnMoney";
    }

    /**
     * 分公司财务 - 退款统计列表跳转
     * @author chaifuyou
     * @date 2021/7/14 11:39
     * @return
     */
    @RequestMapping("/finance/statBackMoney")
    public String statBackMoney(HttpServletRequest request, ModelMap model) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();//当前登录人信息
        if("3".equals(userAccount.getDeptId())){
            return "crmSystem/finance/superStatBackMoney";
        }
        return "crmSystem/finance/statBackMoney";
    }


    /**
     * 合同管理-用户端-活动产品
     * @param request
     * @return
     */
    @RequestMapping("/contractManager/activityProduct")
    public String activityProduct(HttpServletRequest request) {
        String url = "crmSystem/contractManager/user/activityProduct";
        return url;
    }

    /**
     * 跳转系统管理-呼叫管理
     * @Author renshaorong
     * @Date 2021/4/22
     * @param request
     * @return
     */
    @RequestMapping("/systemManager/callManager")
    public String callManage(HttpServletRequest request) {
        String url = "crmSystem/systemManager/callManager/callManagement";
        return url;
    }

    /**
     * 跳转任务管理-任务管理页面
     * @Author renshaorong
     * @Date 2021/4/25
     * @param request
     * @return
     */
    @RequestMapping("/taskManager/taskManager")
    public String taskManager(HttpServletRequest request) {
        String url = "crmSystem/taskManager/taskInfo";
        return url;
    }

    /**
     * 课程管理-用户端
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/user/courseManager/courseArrange")
    public String courseArrange(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/coursearrange/user/userCourseArrange";
        return url;
    }

    /***
     * @Description:用户端 任务管理-任务列表
     * @Author: luojie
     * @Date: 2021/4/26 11:12
     */
    @RequestMapping("/user/taskManager/taskList")
    public String userTaskList(HttpServletRequest request) {
        String url = "crmSystem/taskManager/user/taskList";
        return url;
    }



    /**
     * 课程报名列表-用户端
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/user/courseManager/courseRegist")
    public String courseRegist(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/coursearrange/user/userCourseJoinList";
        return url;
    }

    /**
     * 管理端-商机管理-商机数据指标
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/opportunityManager/opportunityData")
    public String opportunityData(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/opportunityManager/opportunityData";
        return url;
    }

    @RequestMapping("customerManager/customerStatistics")
    public String customerStatistics(){
        return "crmSystem/customerManager/customerStatistics";
    }

    /**
     * 管理端-个人业绩报表
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/resultsManager/personalResults")
    public String personalResults(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/personalresults/personalResultsReport";
        return url;
    }

    /**
     * 用户模块-客户管理-单品客户
     * @Author pym
     * @Date  2021/4/29 14:48
     * @param request
     * @param model
     * @return {@link {java.lang.String}}
     */
    @RequestMapping("/customerManager/userSingleProductCustomerForm")
    public String userSingleProductCustomerForm(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/customerManager/user/userSingleProductCustomerForm";
        return url;
    }


    /**
     * @Description: 管理端课程列表
     * @Param: [request, model]
     * @Return: java.lang.String
     * @Author: lixq-f
     * @Date: 2021/4/30
     **/
    @RequestMapping("/courseManager/managerCourseList")
    public String managerCourseList(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/coursearrange/courseManagerList";
        return url;
    }


    /**
     * 管理端查看课程报名列表
     * @param request
     * @param model
     * @param courseArrangeId,courseName,courseStartTm,courseStatus
     * @return
     */
    @RequestMapping("/courseManager/managerCourseRegistList")
    public String managerCourseRegistList(HttpServletRequest request, ModelMap model,
                                          @RequestParam(value = "courseArrangeId") String courseArrangeId,
                                          @RequestParam(value = "courseName") String courseName,
                                          @RequestParam(value = "courseStartTm") String courseStartTm,
                                          @RequestParam(value = "courseStatus") String courseStatus,
                                          @RequestParam(value = "courseStartPlace") String courseStartPlace) {
        model.addAttribute("courseArrangeId", courseArrangeId);
        model.addAttribute("courseName", courseName);
        model.addAttribute("courseStartTm", courseStartTm);
        model.addAttribute("courseStatus", courseStatus);
        model.addAttribute("courseStartPlace", courseStartPlace);
        String url = "crmSystem/coursearrange/courseRegistManagerList";
        return url;
    }



    /**
     * @Description: 管理端-知识条目
     * @Param: [request, model]
     * @Return: java.lang.String
     * @Author: lixq-f
     * @Date: 2021/4/30
     **/
    @RequestMapping("/productManager/knowledgeItem")
    public String knowledgeItem(HttpServletRequest request, ModelMap model) {
        String url = "";
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        boolean admin = CommonUtils.isAdmin(userAccount.getUserId());
        model.put("ifAdmin",admin);
        if(admin){
            url = "crmSystem/productManager/knowledgeItem";
        }else {
            url = "crmSystem/productManager/user/userKnowledgeItem";
        }
        return url;
    }


    /**
     * @Description: 用户端-知识条目
     * @Param: [request, model]
     * @Return: java.lang.String
     * @Author: lixq-f
     * @Date: 2021/4/30
     **/
    @RequestMapping("/user/productManager/knowledgeItem")
    public String userKnowledgeItem(HttpServletRequest request, ModelMap model) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        boolean admin = CommonUtils.isAdmin(userAccount.getUserId());
        model.put("ifAdmin",admin);
        String url = "crmSystem/productManager/user/userKnowledgeItem";
        return url;
    }



    /**
     * @Description: 用户端-数据搜索
     * @Param: [request, model]
     * @Return: java.lang.String
     * @Author: lixq-f
     * @Date: 2021/4/30
     **/
    @RequestMapping("/user/dataSearch")
    public String userDataSearch(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/datasearch/user/userDataSearch";
        return url;
    }


    /**
     * @Description: 管理端-数据搜索
     * @Param: [request, model]
     * @Return: java.lang.String
     * @Author: lixq-f
     * @Date: 2021/4/30
     **/
    @RequestMapping("/manager/dataSearch")
    public String managerDataSearch(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/datasearch/managerDataSearch";
        return url;
    }

    /**
     * 客户管理 - 单品客户详情
     * @Author pym
     * @Date  2021/5/12 15:29
     * @param request
     * @param model
     * @param customerId 客户ID
     * @param singleProductCustomerId 单品客户主键ID
     * @return {@link {java.lang.String}}
     */
    @RequestMapping("/user/customerManager/userSingleProductCustomerDetail")
    public String userSingleProductCustomerDetail(HttpServletRequest request, ModelMap model,
                                                  @RequestParam(value = "customerId") String customerId,
                                                  @RequestParam(value = "singleProductCustomerId") String singleProductCustomerId) {
        model.addAttribute("customerId", customerId);
        model.addAttribute("singleProductCustomerId", singleProductCustomerId);
        String url = "crmSystem/customerManager/user/userSingleProductCustomerDetail";
        return url;
    }

    /***
     * @Description:系统管理-公司管理
     * @Author: luojie
     * @Date: 2021/5/19 15:17
     */
    @RequestMapping("/systemManager/companyManagement")
    public String companyManagement(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/user/company";
        return url;
    }


    /**
     * @Description: 客户管理-单品客户-创建合同
     * @Param: [request, model]
     * @Return: java.lang.String
     * @Author: lixq-f
     * @Date: 2021/5/21
     **/
    @RequestMapping("/user/customerManager/singleProduct/createContract")
    public String singleProductCreateContract(HttpServletRequest request, ModelMap model,
                                              @RequestParam(value = "singleProductCustomerId") String singleProductCustomerId,
                                              @RequestParam(value = "customerId") String customerId,
                                              @RequestParam(value = "customerName") String customerName) {
        model.addAttribute("singleProductCustomerId", singleProductCustomerId);
        model.addAttribute("customerId", customerId);
        model.addAttribute("customerName", customerName);
        String url = "crmSystem/customerManager/user/userCreateContract";
        return url;
    }






    /**
     * 用户模块-工单管理
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/workOrderManager/userWorkOrderForm")
    public String userWorkOrderForm(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/workOrderManager/user/userWorkOrderForm";
        return url;
    }

    /**
     * 管理模块-工单管理
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/workOrderManager/workOrderForm")
    public String workOrderForm(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/workOrderManager/workOrderForm";
        return url;
    }

    /**
     * 用户端-新增工单
     * @param request
     * @return
     * @author lj
     */
    @RequestMapping("/workOrderManager/addWorkOrder")
    public String addWorkOrder(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/workOrderManager/addWorkOrder";
        return url;
    }

    /**
     * 用户端-工单管理-工单详情
     * @param request
     * @return
     * @author lj
     */
    @RequestMapping("/workOrderManager/workOrderDetail")
    public String userWorkOrderDetail(HttpServletRequest request, ModelMap model,@RequestParam(value = "workOrderId") String workOrderId,
                                      @RequestParam(value = "userName") String userName) {
        WorkOrder workOrder  =workOrderService.getWorkOrderById(workOrderId);
        Date namet = workOrder.getCreateTm();
        if (namet != null) {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String createTm = formatter.format(namet);
            model.addAttribute("createTm", createTm);
        } else {
            model.addAttribute("createTm", "");
        }
        model.addAttribute("userName",userName);
        model.addAttribute("workOrder",workOrder);
        String url = "crmSystem/workOrderManager/user/userWorkOrderDetail";
        return url;
    }

    /**
     * 客户导入失败日志
     * @Author pym
     * @Date  2021/5/28 7:57
     * @param request
     * @param model
     * @return {@link {java.lang.String}}
     */
    @RequestMapping("/customerManager/customerImportFailureLog")
    public String customerImportFailureLog(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/customerManager/user/customerImportFailureLog";
        return url;
    }

    /**
     * 订单导入失败日志
     * @Author pym
     * @Date  2021/6/8 14:21
     * @param request
     * @param model
     * @return {@link {java.lang.String}}
     */
    @RequestMapping("/orderManager/orderImportFailureLog")
    public String orderImportFailureLog(HttpServletRequest request, ModelMap model) {
        return "crmSystem/orderManager/user/orderImportFailureLog";
    }


    /**
     * 财经新闻
     * @Author yyf
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/situationAware/financialNews")
    public String financialNews(HttpServletRequest request, ModelMap model) {
        return "crmSystem/situationAware/financialNews";
    }

    /**
     * 数据中心
     * @Author yyf
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/situationAware/spiderDataForm")
    public String spiderDataForm(HttpServletRequest request, ModelMap model ) {
//        model.addAttribute("companyName",companyName);
        return "crmSystem/situationAware/spiderDataForm";
    }



    /**
     * @Description: 课程报名审核列表
     * @Param: [request, model]
     * @Return: java.lang.String
     * @Author: lixq-f
     * @Date: 2021/6/9
     **/
    @RequestMapping("/auditManager/courseAuditList")
    public String courseAudit(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/coursearrange/courseAuditList";
        return url;
    }


    /**
     * @Description: 课程报名消费列表
     * @Param: [request, model]
     * @Return: java.lang.String
     * @Author: lixq-f
     * @Date: 2021/6/9
     **/
    @RequestMapping("/auditManager/registConsumeList")
    public String registConsume(HttpServletRequest request, ModelMap model,
                                @RequestParam(value = "courseArrangeId") String courseArrangeId,
                                @RequestParam(value = "enterEndTm") String enterEndTm) {
        model.addAttribute("courseArrangeId",courseArrangeId);
        model.addAttribute("enterEndTm",enterEndTm);
        String url = "crmSystem/coursearrange/registConsumeList";
        return url;
    }

    /**
     * 用户模块-内训管理-外训内训线索
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/trainingManager/userTrainingForm")
    public String usertrainingForm(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/trainingManager/user/userTrainingForm";
        return url;
    }

    /**
     * 用户模块-内训管理-内训线索
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/trainingManager/userTrainingFormNx")
    public String userTrainingFormNx(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/trainingManager/user/userTrainingFormNx";
        return url;
    }

    /**
     * 内训管理--(管理端)内训线索池列表
     * @author yincuimei(2121-09-06)
     * @return
     */
    @RequestMapping("/internalTrainingManager/internalTrainingCluePool")
    public String internalTrainingCluePool(){
        return "crmSystem/trainingManager/internalTrainingCluePool";
    }

    /**
     * 内训管理->(管理端)内训线索池列表->内训详情
     * @author yincuimei
     * @return
     */
    @RequestMapping("/trainingManager/internalTrainingDetail")
    public String internalTrainingDetail( ModelMap model,@RequestParam(value = "trainingId") String trainingId){
        TrainingDetailVO trainingDetailVO = trainingService.selectTrainingDetailVOById(trainingId);
        model.addAttribute("training", trainingDetailVO);
        return "crmSystem/trainingManager/internalTrainingDetail";
    }

    /**
     * 内训管理->(用户端)内训管理->内训合同列表
     * @author yincuimei
     * @return
     */
    @RequestMapping("/internalTrainingManager/trainingContractList")
    public String trainingContractList(){
        return "crmSystem/trainingManager/user/trainingContractList";
    }

    /**
     * 内训管理->(用户端)内训管理->内训合同列表-》合同详情
     * @author yincuimei
     * @return
     */
    @RequestMapping("/internalTrainingManager/trainingContractDetail")
    public String trainingContractDetail(ModelMap model,@RequestParam(value="trainingContractId", required = false) String trainingContractId){
        TrainingContractDetailVO trainingContractDetailVO = trainingContractService.selectTrainingContractDetailVO(trainingContractId);
        model.put("trainingContract", trainingContractDetailVO);
        return "crmSystem/trainingManager/user/trainingContractDetail";
    }


    /**
     * 管理模块-客户公海-内训线索详情
     *
     * @param request
     * @param model
     * @param trainingId 客户id
     * @return
     */
    @RequestMapping("/trainingManager/userTrainingDetail")
    public String userTrainingDetail(HttpServletRequest request, ModelMap model,
                                     @RequestParam(value = "trainingId") String trainingId) {

        TrainingVO training = trainingService.selectByTrainingId(trainingId);
        model.addAttribute("training", training);


        Date namet = training.getCreateTm();
        if (namet != null) {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
            String createTm = formatter.format(namet);
            model.addAttribute("createTm", createTm);
        } else {
            model.addAttribute("createTm", "");
        }

        Date membershipExpirationTmt = training.getMembershipExpirationTm();
        if (membershipExpirationTmt != null) {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
            String membershipExpirationTm = formatter.format(membershipExpirationTmt);
            model.addAttribute("membershipExpirationTm", membershipExpirationTm);
        } else {
            model.addAttribute("membershipExpirationTm", "该客户不是会员");
        }

        if(training.getCurrentState() != null) {
            if (!StringUtils.isBlank(training.getCurrentState().toString())) {
                if (training.getCurrentState().toString().equals("0")) {
                    model.addAttribute("currentState", "需求分析");
                } else if (training.getCurrentState().toString().equals("1")) {
                    model.addAttribute("currentState", "方案报价");
                } else if (training.getCurrentState().toString().equals("2")) {
                    model.addAttribute("currentState", "洽谈合同");
                } else if (training.getCurrentState().toString().equals("3")) {
                    model.addAttribute("currentState", "赢单");
                } else {
                    model.addAttribute("currentState", "输单");
                }
            }
        } else {
            model.addAttribute("currentState", "");
        }
        return "crmSystem/trainingManager/user/userTrainingDetail";
    }

    /**
     * 导入失败日志
     * @Author pym
     * @Date  2021/6/15 14:04
     * @param request
     * @param model
     * @return {@link {java.lang.String}}
     */
    @RequestMapping("/systemManager/importFailureLog")
    public String importFailureLog(HttpServletRequest request, ModelMap model) {
        return "crmSystem/systemManager/importFailureLog";
    }

    /**
     * 用户端-工作日志
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/user/userWorkLogList")
    public String userWorkLogList(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/worklog/user/userWorkLogList";
        return url;
    }

    /**
     * 管理端-工作日志
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/manage/manageWorkLogList")
    public String manageWorkLogList(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/worklog/manageWorkLogList";
        return url;
    }


    /**
     * @Description: 新增工作日志页面
     * @Param: [request, model]
     * @Return: java.lang.String
     * @Author: lixq-f
     * @Date: 2021/6/25
     **/
    @RequestMapping("/workLog/addWorkLog")
    public String addWorkLog(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/worklog/user/addWorkLog";
        return url;
    }


    /**
     * @Description: 查看工作日志
     * @Param: [request, model]
     * @Return: java.lang.String
     * @Author: lixq-f
     * @Date: 2021/6/29
     **/
    @RequestMapping("/workLog/viewWorkLog")
    public String viewWorkLog(HttpServletRequest request, ModelMap model,
                              @RequestParam(value = "logId") String logId) {
        model.addAttribute("logId",logId);
        String url = "crmSystem/worklog/user/userWorkLogView";
        return url;
    }

    /***
     * @Description: 核实电话
     * @Author: luojie
     * @Date: 2021/7/8 9:14
     */
    @RequestMapping("/verifyPhone/verifyPhoneList")
    public String verifyPhoneList(HttpServletRequest request) {
        String url = "crmSystem/verifyPhone/verifyPhoneList";
        return url;
    }


    /***
     * 信息错误
     * @Author renshaorong
     * @Date 2021/7/12
     */
    @RequestMapping("/memberManager/infomationError")
    public String infomationError(HttpServletRequest request) {
        String url = "crmSystem/memberManager/infomationError";
        return url;
    }



    /**
     * @Description: 电话核实报表
     * @Param: [request]
     * @Return: java.lang.String
     * @Author: lixq-f
     * @Date: 2021/7/13
     **/
    @RequestMapping("/manage/verifyPhoneReport")
    public String verifyPhoneReport(HttpServletRequest request) {
        String url = "crmSystem/verifyPhone/manageVerifyPhoneReport";
        return url;
    }

    /**
     * 客服-关联审核
     *
     * @param request
     * @param
     * @Author baijian
     * @Date 2021/7/13 13:51
     */
    @RequestMapping("/customerRelationManager/customerRelationForm")
    public String customerRelationForm(HttpServletRequest request) {
        String url = "crmSystem/customerManager/customerRelationForm";
        return url;
    }

    /**
     * 客服-会员管理-会员卡管理
     *
     * @param request
     * @param
     * @Author baijian
     * @Date 2021/7/13 13:51
     */
    @RequestMapping("/memberManager/memberCardOldForm")
    public String memberCardOldForm(HttpServletRequest request) {
        String url = "crmSystem/memberManager/user/memberCardOldForm";
        return url;
    }

    /**
     * 管理端-工单管理-原始数据
     * @Author pym
     * @Date  2021/7/20 11:43
     * @param request
     * @param model
     * @return {@link {java.lang.String}}
     */
    @GetMapping("/workOrderManager/rawData")
    public String rawData( HttpServletRequest request,ModelMap model){
        String url = "crmSystem/workOrderManager/rawData";
        return url;
    }

    /**
     * 客服部->客户管理->客户列表
     * @author yincuimei(2021-7-22)
     * @return
     */
    @GetMapping("/csd/customerManager/customerList")
    private String customerList(){
        String url = "crmSystem/csd/customerManager/customerList";
        return url;
    }

    /**
     * 客服部->客户管理->客户列表->(企业客户)->客户详情
     * @author yincuimei(2021-8-13)
     * @return
     */
    @GetMapping("/csd/customerManager/customerDetail")
    private String customerDetail( ModelMap model, @RequestParam(value = "customerId") String customerId){
        CustomerDetailVO customerDetailVO = csdCustomerService.selectCustomerDetailVO(customerId);
        model.put("customer",customerDetailVO);
        String url = "crmSystem/csd/customerManager/customerDetail";
        return url;
    }

    /**
     * 客服部->客户管理->客户列表->(企业客户)->客户详情-->会员卡详情
     * @author yincuimei(2021-8-13)
     * @return
     */
    @RequestMapping("/csd/customerManager/customerCardDetail")
    public String customerCardDetail( ModelMap model, @RequestParam(value = "customerProductDetailMemberCardId") String customerProductDetailMemberCardId,
                                       @RequestParam(value = "memberCardNumber") String memberCardNumber){
        CustomerMemberCardDetailVO vo = csdCustomerService.selectCustomerCardDetail(customerProductDetailMemberCardId,memberCardNumber);
        model.put("vo",vo);
        String url = "crmSystem/csd/customerManager/customerCardDetail";
        return url;
    }

    /**
     * 客服部->客户管理->客户列表-客户查看-》合同&订单列表-》合同详情
     * @author yincuimei(2021-8-30)
     * @return
     */
    @GetMapping("/csd/customerManager/customerContractDetail")
    private String customerContractDetail(ModelMap model, @RequestParam String contractId, @RequestParam String orderId){
        model.put("contractId",contractId);
        model.put("orderId",orderId);
        String url = "crmSystem/csd/customerManager/customerContractDetail";
        return url;
    }

    /**
     * (客服部)客户管理->联系人维护
     * @author yincuimei(2021-10-25)
     * @return
     */
    @GetMapping("/csd/customerManager/contactMaintain")
    private String contactMaintain(){
        String url = "crmSystem/csd/customerManager/contactMaintainList";
        return url;
    }


    /**
     * 客服部->审核管理->备案信息列表
     * @author yincuimei(2021-8-06)
     * @return
     */
    @GetMapping("/csd/reviewManager/putOnRecordForm")
    private String putOnRecordForm(){
        String url = "crmSystem/csd/reviewManager/putOnRecordForm";
        return url;
    }

    /**
     * 客服部->跟进管理->跟进记录
     * @author yincuimei(2021-11-11)
     * @return
     */
    @RequestMapping("/csd/followManager/followList")
    private String followList(ModelMap model) {
        String url = "crmSystem/csd/followManager/followList";
        model.addAttribute("esurl", ESurl);
        return url;
    }

    /**
     * 【客服部】课程管理->课程列表
     * @author yincuimei
     * @date 2021-12-15 14:38
     * @return
     */
    @RequestMapping("/csd/courseManager/courseList")
    private String courseList(){
        String url = "crmSystem/csd/courseManager/courseList";
        return url;
    }

    /**
     * 联系人管理->联系方式一机多用
     * @author baijian(2021-7-27)
     * @return
     */
    @GetMapping("/contactManager/userContactInformationManyPeopleForm")
    private String userContactInformationManyPeopleForm(){
        String url = "crmSystem/contactManager/user/userContactInformationManyPeopleForm";
        return url;
    }

    /***
     * @Description:合同审核-合同列表
     * @Param:
     * @Author: luojie
     * @Date: 2021/7/28 14:23
     */
    @GetMapping("/contractReviewManager/contractForm")
    private String contractForm(){
        String url = "crmSystem/contractReviewManager/contractForm";
        return url;
    }

    /**
     * 发码列表
     * @author baijian
     * @date 2021/8/7 13:58
     * @param
     * @return
     */
    @RequestMapping("/systemManager/sendCode")
    public String systemParameterSetting(HttpServletRequest request, ModelMap model) {
        return "crmSystem/systemManager/sendCode";
    }

    /**
     * 呼叫流水
     * @Author renshaorong
     * @Date 2021/8/9
     * @param
     * @return
     */
    @RequestMapping("/callCenter/callFlow")
    public String callFlow(HttpServletRequest request, ModelMap model) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();//获取登录人信息
        model.addAttribute("companyId",userAccount.getCompanyId());
        return "crmSystem/callcenter/callFlow";
    }


    @RequestMapping("/callCenter/callFlowUser")
    public String callFlowUser(HttpServletRequest request, ModelMap model) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();//获取登录人信息
        model.addAttribute("accountId", userAccount.getAccountId());
        return "crmSystem/callcenter/callFlowUser";
    }
    /**
     * 月份报表统计
     * @Author pym
     * @Date  2021/8/16 14:03
     * @param request
     * @return {@link {java.lang.String}}
     */
    @RequestMapping("/orderManager/exportOrderProduct")
    public String exportOrderProduct(HttpServletRequest request){
        String url = "crmSystem/orderManager/user/exportOrderProduct";
        return url;
    }

    /**
     * 到款记录
     * @Author pym
     * @Date  2021/8/19 7:56
     * @param request
     * @param model
     * @return {@link {java.lang.String}}
     */
    @RequestMapping("/finance/paymentRecord")
    public String paymentRecord(HttpServletRequest request, ModelMap model) {
        return "crmSystem/finance/paymentRecord";
    }

    /**
     * @Description:人资报表-通话分析
     * @Author zk
     * @Date  2021-8-24 15:40:54
     * @param request
     * @return {@link {java.lang.String}}
     */
    @RequestMapping("/hrReport/callReport")
    public String callReport(HttpServletRequest request, ModelMap model) {
        return "crmSystem/hrReport/callHrReport";
    }

    /**
     * 合同审核新页面
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/contractReviewManager/contractReviewFormNew")
    public String contractReviewFormNew(HttpServletRequest request, ModelMap model) {
        return "crmSystem/contractReviewManager/contractReviewFormNew";
    }
    /**
     * 客服部->产品管理 ->产品明细
     * @author wangpeng
     * @return
     */
    @GetMapping("/productManager/productDetails")
    private String productDetails(){
        String url = "crmSystem/csd/customerManager/productDetails";
        return url;
    }

    /***
     * @Description:跳转补款升级合同页面
     * @Param:
     * @Author: luojie
     * @Date: 2021/9/1 15:35
     */
    @RequestMapping("/contractManager/contractPromotion")
    public String contractPromotion(HttpServletRequest request, ModelMap model, @RequestParam(value = "contractId") String contractId,
                                    @RequestParam(value = "customerId") String customerId,
                                    @RequestParam(value = "contractType") String contractType) {
        model.put("contractId",contractId);
        model.put("customerId",customerId);
        model.put("contractType",contractType);
        return "crmSystem/contractManager/contractPromotion";
    }

    /**
     * 客服部->产品管理 ->产品兑换
     * @author wangpeng
     * @return
     */
    @GetMapping("/productManager/productExchange")
    private String productExchange(){
        String url = "crmSystem/csd/customerManager/productExchange";
        return url;
    }

    /**
     * 内训客户公海
     * @Author renshaorong
     * @Date 2021/9/3
     */
    @GetMapping("/internalTrainingManager/customerOpenSea")
    private String customerOpenSea(){
        return "crmSystem/internalTrainingManager/customerOpenSea";
    }

    /**
     * 内训客户
     * @Author renshaorong
     * @Date 2021/9/3
     */
    @RequestMapping("/internalTrainingManager/myClientPool")
    public String myClientPool(HttpServletRequest request, ModelMap model) {
        return "crmSystem/internalTrainingManager/myClientPool";
    }

    /**
     * 用户模块-客户公海-客户详情
     *
     * @param request
     * @param model
     * @param customerId 客户id
     * @return
     */
    @RequestMapping("/internalTrainingManager/customerDetail")
    public String customerDetail(HttpServletRequest request, ModelMap model,
                                             @RequestParam(value = "customerId") String customerId) {

        CustomerVO customer = customerPoolService.selectByCustomerId(customerId);
        if(2 == customer.getMemberErrorData()) {
            return "crmSystem/error/locking";
        }
        model.addAttribute("customer", customer);

        Date namet = customer.getRegistrationTime();
        if (namet != null) {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
            String registrationDate = formatter.format(namet);
            model.addAttribute("registrationDate", registrationDate);
        } else {
            model.addAttribute("registrationDate", "");
        }

        Date membershipExpirationTmt = customer.getMembershipExpirationTm();
        if (membershipExpirationTmt != null) {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
            String membershipExpirationTm = formatter.format(membershipExpirationTmt);
            model.addAttribute("membershipExpirationTm", membershipExpirationTm);
        } else {
            model.addAttribute("membershipExpirationTm", "该客户不是会员");
        }


        Dictionary dictionary = new Dictionary();
        //企业状态  enterpriseState
        if (!StringUtils.isBlank(customer.getEnterpriseState())) {
            dictionary = customerPoolService.selectDictionaryByOne("1", customer.getEnterpriseState());
            judge("enterpriseState",dictionary,model);
        } else {
            model.addAttribute("enterpriseState", "");
        }

        //CAPITAL_TYPE("2","资本类型"),   capitalType
        if (!StringUtils.isBlank(customer.getCapitalType())) {
            dictionary = customerPoolService.selectDictionaryByOne("2", customer.getCapitalType());
            judge("capitalType",dictionary,model);
        } else {
            model.addAttribute("capitalType", "");
        }

        //	COMPANY_TYPE("3","公司类型"),	companyType
        if (!StringUtils.isBlank(customer.getCompanyType())) {
            dictionary = customerPoolService.selectDictionaryByOne("3", customer.getCompanyType());
            judge("companyType",dictionary,model);
        } else {
            model.addAttribute("companyType", "");
        }

        //	CLIENT_LEVEL("5","客户级别"), customerLevel
        if (!StringUtils.isBlank(customer.getCustomerLevel())) {
            dictionary = customerPoolService.selectDictionaryByOne("5", customer.getCustomerLevel());
            judge("customerLevel",dictionary,model);
        } else {
            model.addAttribute("customerLevel", "");
        }

        //	COMPANY_SIZE("6","公司规模"),   companySize
        if (!StringUtils.isBlank(customer.getCompanySize())) {
            dictionary = customerPoolService.selectDictionaryByOne("6", customer.getCompanySize());
            judge("companySize",dictionary,model);
        } else {
            model.addAttribute("companySize", "");
        }

        //	INDUSTRY("7","行业"),    industry
        if (!StringUtils.isBlank(customer.getIndustry())) {
            dictionary = customerPoolService.selectDictionaryByOne("7", customer.getIndustry());
            judge("industry",dictionary,model);
        } else {
            model.addAttribute("industry", "");
        }

        //	CUSTOMER_SOURCE("9","客户来源");  customerSource
        if (!StringUtils.isBlank(customer.getCustomerSource())) {
            dictionary = customerPoolService.selectDictionaryByOne("9", customer.getCustomerSource());
            judge("customerSource",dictionary,model);
        } else {
            model.addAttribute("customerSource", "");
        }

        //CUSTOMER_STATE("11","客户状态");  customerState
        if (!StringUtils.isBlank(customer.getCustomerState())) {
            dictionary = customerPoolService.selectDictionaryByOne("11", customer.getCustomerState());
            judge("customerState",dictionary,model);
        } else {
            model.addAttribute("customerState", "");
        }

        //目前状态 0: 未领取; 1: 已领取(我领取的客户);2: 已分配(分配给我的客户);3: 自建客户(用户模块我自建的客户)
        if(customer.getCurrentStatus() != null) {
            if (!StringUtils.isBlank(customer.getCurrentStatus().toString())) {
                if (customer.getCurrentStatus().toString().equals("0")) {
                    model.addAttribute("currentStatus", "未领取");
                } else if (customer.getCurrentStatus().toString().equals("1")) {
                    model.addAttribute("currentStatus", "已领取");
                } else if (customer.getCurrentStatus().toString().equals("2")) {
                    model.addAttribute("currentStatus", "已分配");
                } else {
                    model.addAttribute("currentStatus", "自建客户");
                }
            }
        }else{
            model.addAttribute("currentStatus", "");
        }

        System.out.println(customer.getRegisteredCapital());
        //注册资本
        if (!StringUtils.isBlank(customer.getRegisteredCapital())) {
            model.addAttribute("registeredCapital", customer.getRegisteredCapital());
        } else {
            model.addAttribute("registeredCapital", "");
        }

        String url = "crmSystem/internalTrainingManager/customerDetail";
        return url;
    }


    /**
     * 内训跟进
     * @Author renshaorong
     * @Date 2021/9/14
     */
    @RequestMapping("/internalTrainingManager/follow")
    public String follow(HttpServletRequest request, ModelMap model,String customerId,String customerName) {
        model.addAttribute("customerId",customerId);
        model.addAttribute("customerName",customerName);
        return "crmSystem/internalTrainingManager/follow";
    }

    /**
     * 手机版财务登录
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/finance/phone/phoneLogin")
    public String financePhoneLogin(HttpServletRequest request, ModelMap model) {
        return "crmSystem/finance/phone/phoneLogin";
    }

    @RequestMapping("/finance/phone/returnMoneyList")
    public String financePhoneReturnMoneyList(HttpServletRequest request, ModelMap model) {
        return "crmSystem/finance/phone/phoneReturnMoneyList";
    }

    @RequestMapping("/finance/phone/orderInfo")
    public String financePhoneOrderInfo(HttpServletRequest request, ModelMap model, String productOrderId) {
        FinanceProductOderInfoVO vo = customerProductOrderService.financeProductOderInfo(productOrderId, null);
        CustomerContractDetailVO customerContractDetailVO = customerContractService.selectCustomerContractVODetail(vo.getContractId());
        if (Objects.nonNull(customerContractDetailVO)){
            //隐藏客户信息
            customerContractDetailVO.setContactName(null);
            customerContractDetailVO.setContactDetails(null);
            customerContractDetailVO.setCustomerEmail(null);
        }
        model.addAttribute("vo", vo);
        model.addAttribute("productOrderId", productOrderId);
        model.addAttribute("contractVO", customerContractDetailVO);
        return "crmSystem/finance/phone/phoneOrderInfo";
    }

    /***
     * @Description:用户端新增内训合同
     * @Param:
     * @Author: luojie
     * @Date: 2021/9/17 9:09
     */
    @RequestMapping("/trainingManager/userTrainingAdd")
    public String userTrainingAdd(HttpServletRequest request, ModelMap model,@RequestParam(value = "trainingId") String trainingId) {
        model.addAttribute("trainingId", trainingId);
        return "crmSystem/trainingManager/user/userTrainingAdd";
    }

    /**
     * 内训管理 -新增客户
     * @Author renshaorong
     * @Date 2021/9/16
     * @param request
     * @param model
     */
    @RequestMapping("/internalTrainingManager/addCustomer")
    public String addCustomer(HttpServletRequest request, ModelMap model) {
        return "crmSystem/internalTrainingManager/addCustomer";
    }

    /***
     * @Description:补款升级合同详情跳转
     * @Author: luojie
     * @Date: 2021/9/22 10:25
     */
    @RequestMapping("/contractManager/contractDetailPayment")
    public String contractDetailPayment(HttpServletRequest request, @RequestParam String contractId, ModelMap model,@RequestParam(value = "urlType", required = false) String urlType) {
        String url = "crmSystem/contractManager/contractDetail";
        //合同详情
        CustomerContractDetailVO customerContractDetailVO = customerContractService.selectCustomerContractVODetail(contractId);
        model.put("customerContract", customerContractDetailVO);

        //回款情况
        FinanceProductOderInfoVO financeProductOderInfo = customerProductOrderService.financeProductOderInfo(customerContractDetailVO.getProductOrderId(), null);
        model.addAttribute("financeProductOderInfo", financeProductOderInfo);

        //审核详情
        ContractReviewVO contractReviewVO = contractReviewService.selectContractReviewFinally(contractId);
        model.addAttribute("contractReview", contractReviewVO);

        model.addAttribute("showFlag", false);

        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        if("houxinxue@nsrjlb.cn".equals(userAccount.getUserAccount())){
            model.addAttribute("ifHou", "1");
        }else{
            model.addAttribute("ifHou", "0");
        }

        //判断是否需要显示展示补充材料上传文件按钮
        if (contractReviewVO != null) {
            if (!StringUtils.isBlank(urlType) && "1".equals(customerContractDetailVO.getContractReviewStatus()) &&
                    "1".equals(contractReviewVO.getProcessResult())
            ) {
                model.addAttribute("showFlag", true);
            }
        }
        return "crmSystem/contractManager/contractDetailPayment";

    }
    /**
     * 内训管理-跟进记录
     * @Author renshaorong
     * @Date 2021/9/22
     * @param request
     * @param model
     */
    @RequestMapping("internalTrainingManager/followRecord")
    public String followRecord(HttpServletRequest request, ModelMap model) {
        return "crmSystem/internalTrainingManager/followRecord";
    }

    /**
     * 客服部--审核管理---合同审核列表----合同补款升级审核
     *
     * @return
     * @author yincuimei
     */
    @RequestMapping("/contractReviewManager/contractReviewPayment")
    private String contractReviewPayment(ModelMap model, @RequestParam String contractId, @RequestParam String orderId) {
        model.put("contractId",contractId);
        model.put("orderId",orderId);
        String url = "crmSystem/contractReviewManager/contractReviewPayment";
        return url;
    }

    /**
     * informationLibraryList
     * 客户管理---客户信息库列表
     * @Author wangpeng
     * @Date 2021/9/27
     * @param
     * @return
     */
    @GetMapping("customerManager/informationLibraryList")
    private String informationLibraryList(){
        String url = "crmSystem/csd/customerManager/customerInfoList";
        return url;
    }

    /**
     * 回款统计-业绩明细
     * @author baijian
     * @return
     */
    @GetMapping("/finance/statReturnMoneyDetail")
    private String statReturnMoneyDetail( ModelMap model, @RequestParam(value = "accountId") String accountId){
        model.put("accountId",accountId);
        String url = "crmSystem/finance/statReturnMoneyDetail";
        return url;
    }

    /**
     * 态势感知-企业库
     * @author baijian
     * @return
     */
    @GetMapping("/company/spiderComPany")
    private String spiderComPany( ModelMap model){
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        model.addAttribute("accountId", userAccount.getAccountId());
        model.addAttribute("url", ESurl);
        return "crmSystem/situationAware/spiderCompany";
    }

    /**
     * 报表统计-呼叫报表统计
     * @author baijian
     * @return
     */
    @GetMapping("/callForm/newReport")
    private String newReport( ModelMap model){
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();
        model.addAttribute("accountId", userAccount.getAccountId());
        model.addAttribute("companyId", userAccount.getCompanyId());
        return "crmSystem/callcenter/user/callNewReport";
    }


    /**
     * exchangeReview
     * 兑换审批
     * @Author wangpeng
     * @Date 2021/10/26
     * @param
     * @return
     */
    @GetMapping("contractReviewManager/exchangeReview")
    private String exchangeReview(){
        String url = "crmSystem/csd/customerManager/exchangeApproval";
        return url;
    }


    /**
     * exchangeCenter
     * 兑换中心
     * @Author wangpeng
     * @Date 2021/10/26
     * @param
     * @return
     */
    @GetMapping("customerManager/exchangeCenter")
    private String exchangeCenter(){
        String url = "crmSystem/customerManager/user/exchangeCenter";
        return url;
    }

    /**
     * 财务端-流水审核
     * @Author xielinqi
     * @Date 8:28 上午 2021/11/2
     */
    @RequestMapping("finance/bankFlowExamine")
    public String bankFlowExamine() {
        return "crmSystem/finance/bankFlowExamine";
    }

    /**
     * 流水审核-修改审核详情
     * @Author xielinqi
     * @Date 8:28 上午 2021/11/2
     */
    @RequestMapping("finance/updateExamineDetails/{examineId}")
    public String updateExamineDetails(ModelMap model, @PathVariable("examineId") String examineId,
                                       Integer examineState, String examineInfo, Integer examineType) {
        model.addAttribute("examineId", examineId);
        model.addAttribute("examineState", examineState);
        model.addAttribute("examineInfo", examineInfo);
        model.addAttribute("examineType", examineType);
        return "crmSystem/finance/updateExamineDetails";
    }

    /**
     * 双十一报表-管理
     * @Author renshaorong
     * @Date 2021/11/3
     */
    @RequestMapping("report/reportForNovember")
    public String reportForNovember() {
        return "crmSystem/report/reportForNovember";
    }
    /**
     * 双十一报表(用户)
     * @Author renshaorong
     * @Date 2021/11/3
     */
    @RequestMapping("report/user/reportForNovember")
    public String userReportForNovember() {
        return "crmSystem/report/reportForNovember";
    }

    /**
     *消息列表-用户端
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/messageManager/messageFormUser")
    public String messageFormUser(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/messageManager/user/messageFormUser";
        return url;
    }

    /**
     *消息列表-管理端
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/messageManager/messageForm")
    public String messageForm(HttpServletRequest request, ModelMap model) {
        String url = "crmSystem/messageManager/messageForm";
        return url;
    }

    /**
     * 用户消息详情
     *
     * @param request
     * @param model
     * @param messageId 消息id
     * @param msgType 已发消息的tab传1   其他传2
     * @return
     */
    @RequestMapping("/messageManager/messageDetailUser")
    public String messageDetailUser(HttpServletRequest request, ModelMap model,@RequestParam(value = "messageId") String messageId,
                                                                               @RequestParam(value = "msgType") String msgType) {
        model.addAttribute("messageId", messageId);
        model.addAttribute("msgType", msgType);
        String url = "crmSystem/messageManager/user/messageDetailUser";
        return url;
    }


    /**
     * productExchangeReview
     * @Author wangpeng
     * @Date 2021/11/18
     * @param
     * @return
     */
    @RequestMapping("/messageManager/productExchangeReview")
    public String productExchangeReview() {
        String url = "crmSystem/csd/customerManager/productExchangeReview";
        return url;
    }

    /**
     * 添加优惠券
     *
     * @param request
     * @return
     */
    @RequestMapping("/activityManager/addCoupon")
    public String addCoupon(HttpServletRequest request) {
        return "crmSystem/activityManager/addCoupon";
    }


    /**
     * 优惠券详情
     *
     * @param request
     * type 判断从优惠券页面跳转还是客户详情页面跳转
     * couponId 优惠券ID
     * customerId 客户ID
     * @return
     */
    @RequestMapping("/activityManager/couponDetail")
    public String couponDetail(HttpServletRequest request,ModelMap model,@RequestParam(value = "type") Integer type,
                               @RequestParam(value = "couponId")  String couponId,
                               @RequestParam(value = "customerId" , required = false) String customerId) {
        model.addAttribute("type", type);
        model.addAttribute("couponId", couponId);
        model.addAttribute("customerId", customerId);
        return "crmSystem/activityManager/couponDetail";
    }

    /**
     * 客户调转-管理员页面
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/customerManager/customerTran")
    public String customerTran(HttpServletRequest request, ModelMap model) {
        model.addAttribute("spiderUrl", spiderUrl);
        return "crmSystem/customerManager/customerTran";
    }

    /**
     * 客户调转-普通用户页面
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/customerManager/customerTranByUser")
    public String customerTranByUser(HttpServletRequest request, ModelMap model) {
        model.addAttribute("spiderUrl", spiderUrl);
        return "crmSystem/customerManager/customerTranByUser";
    }

    /**
     * 客户调转详情
     *
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("/customerManager/customerTranDetail")
    public String customerTranDetail(HttpServletRequest request, ModelMap model, Integer id,Integer type) {
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        String result=null;
        if (type==0){
            //管理员查询
            result = HttpUtil.post(spiderUrl + "/qcc/selectById", map); // 调dc_spider获取企业详细信息
        }else {
            //普通用户查询
            result = HttpUtil.post(spiderUrl + "/qcc/selectByIdByEs", map); // 调dc_spider获取企业详细信息
        }

        System.out.println(result);
        model.addAttribute("customerTranDetail", JSONObject.parseObject(result));
        return "crmSystem/customerManager/customerTranDetail";
    }

    /**
     * 客服端-回款审核
     * @Author xielinqi
     * @Date 10:47 上午 2021/12/7
     */
    @RequestMapping("finance/returnMoneyExamine")
    public String returnMoneyExamine() {
        return "crmSystem/finance/returnMoneyExamine";
    }



    /**
     * 客服部-信息库-客户详情
     * @Author renshaorong
     * @Date 2021/12/13
     * @param request
     * @param model
     * @param customerInfoId 客户id
     * @return
     */
    @RequestMapping("/csd/customerInfo/customerDetail")
    public String customerInfoDetail(HttpServletRequest request, ModelMap model,
                                         @RequestParam(value = "customerInfoId") String customerInfoId) {
        CustomerInfo customerInfoDetail = csdCustomerService.getCustomerInfoDetailByCustomerInfoId(customerInfoId);
        model.addAttribute("customerInfoDetail",customerInfoDetail);

        return "crmSystem/csd/customerManager/customerInfoDetail";
    }

}